Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libpod (Podman REST API) spec can't be parsed #4834

Closed
kanpov opened this issue Jun 15, 2024 · 3 comments · Fixed by #4840
Closed

Libpod (Podman REST API) spec can't be parsed #4834

kanpov opened this issue Jun 15, 2024 · 3 comments · Fixed by #4840
Assignees
Labels
Csharp Pull requests that update .net code generator Issues or improvements relater to generation capabilities. type:bug A broken experience
Milestone

Comments

@kanpov
Copy link

kanpov commented Jun 15, 2024

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

Csharp

Describe the bug

I am trying to generate a C# client from the official Libpod OpenAPI specification via the following command:
kiota generate -l CSharp --log-level trace --output ./ --namespace-name LibpodSharp --class-name LibpodSharpApiClient --exclude-backward-compatible --openapi https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml

Expected behavior

The expected behavior would be for the generate command to succeed, as the OpenAPI spec is clearly correct and renders perfectly on editor.swagger.io.

How to reproduce

Install the Kiota global .NET tool.
Run the command given above.

Open API description file

https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml

Kiota Version

1.15.0+b535a94064cd8c14a022aaba42964467d5db525a

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

Haven't found any workaround yet.

Configuration

  • OS: Linux
  • Distribution: openSUSE Tumbleweed (snapshot 20240606)
  • CPU architecture: amd64
    Doubt there's anything that specifically has to do with my configuration.

The output of dotnet --info:

.NET SDK:
 Version:           8.0.301
 Commit:            1a0e9c0300
 Workload version:  8.0.300-manifests.011fccd5
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     opensuse-tumbleweed
 OS Version:  20240606
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/8.0.301/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.6
  Architecture: x64
  Commit:       3b8b000a0e

.NET SDKs installed:
  8.0.301 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Debug output

Click to expand log ``` trce: Kiota.Builder.KiotaBuilder[0] configuration: {"Generation":{"ShouldGetApiManifest":false,"SkipGeneration":false,"Operation":null,"OpenAPIFilePath":"https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml","ApiManifestPath":"/home/kanpov/.tmp/apimanifest.json","OutputPath":"/home/kanpov/.tmp/./","ClientClassName":"LibpodSharpApiClient","ClientNamespaceName":"LibpodSharp","NamespaceNameSeparator":".","ModelsNamespaceName":"LibpodSharp.models","Language":0,"PluginTypes":[],"ApiRootUrl":null,"UsesBackingStore":false,"ExcludeBackwardCompatible":true,"IncludeBackwardCompatible":false,"IncludeAdditionalData":true,"Serializers":["Microsoft.Kiota.Serialization.Json.JsonSerializationWriterFactory","Microsoft.Kiota.Serialization.Text.TextSerializationWriterFactory","Microsoft.Kiota.Serialization.Form.FormSerializationWriterFactory","Microsoft.Kiota.Serialization.Multipart.MultipartSerializationWriterFactory"],"Deserializers":["Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory","Microsoft.Kiota.Serialization.Text.TextParseNodeFactory","Microsoft.Kiota.Serialization.Form.FormParseNodeFactory"],"ShouldWriteNamespaceIndices":false,"ShouldWriteBarrelsIfClassExists":false,"CleanOutput":false,"StructuredMimeTypes":["application/json","text/plain;q=0.9","application/x-www-form-urlencoded;q=0.2","multipart/form-data;q=0.1"],"IncludePatterns":[],"ExcludePatterns":[],"PatternsOverride":[],"ClearCache":false,"DisabledValidationRules":[],"MaxDegreeOfParallelism":-1,"IsPluginConfiguration":false,"DisableSSLValidation":false},"Search":{"APIsGuruListUrl":"https://raw.githubusercontent.com/APIs-guru/openapi-directory/gh-pages/v2/list.json","GitHub":{"AppId":"Iv1.9ed2bcb878c90617","ApiBaseUrl":"https://api.github.com","BlockListUrl":"https://raw.githubusercontent.com/microsoft/kiota/main/resources/index-block-list.yml","AppManagement":"https://aka.ms/kiota/install/github"},"ClearCache":false},"Download":{"OutputPath":"./output/result.json","CleanOutput":false,"DisableSSLValidation":false,"ClearCache":false},"Languages":{"CLI":{"MaturityLevel":1,"Dependencies":[{"Name":"Microsoft.Kiota.Abstractions","Version":"1.9.0"},{"Name":"Microsoft.Kiota.Http.HttpClientLibrary","Version":"1.4.3"},{"Name":"Microsoft.Kiota.Serialization.Form","Version":"1.2.4"},{"Name":"Microsoft.Kiota.Serialization.Json","Version":"1.3.3"},{"Name":"Microsoft.Kiota.Authentication.Azure","Version":"1.1.7"},{"Name":"Microsoft.Kiota.Serialization.Text","Version":"1.2.2"},{"Name":"Microsoft.Kiota.Cli.Commons","Version":"1.1.1"}],"DependencyInstallCommand":"dotnet add package {0} --version {1}","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"CSharp":{"MaturityLevel":2,"Dependencies":[{"Name":"Microsoft.Kiota.Abstractions","Version":"1.9.0"},{"Name":"Microsoft.Kiota.Http.HttpClientLibrary","Version":"1.4.3"},{"Name":"Microsoft.Kiota.Serialization.Form","Version":"1.2.4"},{"Name":"Microsoft.Kiota.Serialization.Json","Version":"1.3.3"},{"Name":"Microsoft.Kiota.Authentication.Azure","Version":"1.1.7"},{"Name":"Microsoft.Kiota.Serialization.Text","Version":"1.2.2"},{"Name":"Microsoft.Kiota.Serialization.Multipart","Version":"1.1.5"}],"DependencyInstallCommand":"dotnet add package {0} --version {1}","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"Go":{"MaturityLevel":2,"Dependencies":[{"Name":"github.com/microsoft/kiota-abstractions-go","Version":"v1.6.0"},{"Name":"github.com/microsoft/kiota-http-go","Version":"v1.4.1"},{"Name":"github.com/microsoft/kiota-serialization-form-go","Version":"v1.0.0"},{"Name":"github.com/microsoft/kiota-serialization-json-go","Version":"v1.0.7"},{"Name":"github.com/microsoft/kiota-authentication-azure-go","Version":"v1.0.2"},{"Name":"github.com/microsoft/kiota-serialization-text-go","Version":"v1.0.0"},{"Name":"github.com/microsoft/kiota-serialization-multipart-go","Version":"v1.0.0"}],"DependencyInstallCommand":"go get {0}@{1}","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"Java":{"MaturityLevel":2,"Dependencies":[{"Name":"com.microsoft.kiota:microsoft-kiota-abstractions","Version":"1.1.13"},{"Name":"com.microsoft.kiota:microsoft-kiota-http-okHttp","Version":"1.1.13"},{"Name":"com.microsoft.kiota:microsoft-kiota-serialization-form","Version":"1.1.13"},{"Name":"com.microsoft.kiota:microsoft-kiota-serialization-json","Version":"1.1.13"},{"Name":"com.microsoft.kiota:microsoft-kiota-authentication-azure","Version":"1.1.13"},{"Name":"com.microsoft.kiota:microsoft-kiota-serialization-text","Version":"1.1.13"},{"Name":"com.microsoft.kiota:microsoft-kiota-serialization-multipart","Version":"1.1.13"},{"Name":"jakarta.annotation:jakarta.annotation-api","Version":"3.0.0"}],"DependencyInstallCommand":"{0}:{1}","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"PHP":{"MaturityLevel":2,"Dependencies":[{"Name":"microsoft/kiota-abstractions","Version":"1.4.0"},{"Name":"microsoft/kiota-http-guzzle","Version":"1.3.0"},{"Name":"microsoft/kiota-serialization-json","Version":"1.3.0"},{"Name":"microsoft/kiota-authentication-phpleague","Version":"1.1.0"},{"Name":"microsoft/kiota-serialization-text","Version":"1.1.0"},{"Name":"microsoft/kiota-serialization-multipart","Version":"1.0.0"},{"Name":"microsoft/kiota-serialization-form","Version":"1.1.1"}],"DependencyInstallCommand":"composer require {0}:{1}","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"Python":{"MaturityLevel":2,"Dependencies":[{"Name":"microsoft-kiota-abstractions","Version":"1.3.3"},{"Name":"microsoft-kiota-http","Version":"1.3.1"},{"Name":"microsoft-kiota-serialization-json","Version":"1.2.0"},{"Name":"microsoft-kiota-authentication-azure","Version":"1.0.0"},{"Name":"microsoft-kiota-serialization-text","Version":"1.0.0"},{"Name":"microsoft-kiota-serialization-form","Version":"0.1.0"},{"Name":"microsoft-kiota-serialization-multipart","Version":"0.1.0"}],"DependencyInstallCommand":"pip install {0}=={1}","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"Ruby":{"MaturityLevel":0,"Dependencies":[{"Name":"microsoft_kiota_abstractions","Version":"0.14.4"},{"Name":"microsoft_kiota_faraday","Version":"0.15.0"},{"Name":"microsoft_kiota_serialization_json","Version":"0.9.1"},{"Name":"microsoft_kiota_authentication_oauth","Version":"0.8.0"}],"DependencyInstallCommand":"gem install \u0022{0}\u0022 -v \u0022{1}\u0022","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"Swift":{"MaturityLevel":0,"Dependencies":[],"DependencyInstallCommand":"","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]},"TypeScript":{"MaturityLevel":1,"Dependencies":[{"Name":"@microsoft/kiota-abstractions","Version":"1.0.0-preview.54"},{"Name":"@microsoft/kiota-http-fetchlibrary","Version":"1.0.0-preview.53"},{"Name":"@microsoft/kiota-serialization-form","Version":"1.0.0-preview.43"},{"Name":"@microsoft/kiota-serialization-json","Version":"1.0.0-preview.54"},{"Name":"@microsoft/kiota-authentication-azure","Version":"1.0.0-preview.49"},{"Name":"@microsoft/kiota-serialization-text","Version":"1.0.0-preview.51"},{"Name":"@microsoft/kiota-serialization-multipart","Version":"1.0.0-preview.32"}],"DependencyInstallCommand":"npm install {0}@{1} -SE","ClientClassName":"","ClientNamespaceName":"","StructuredMimeTypes":[]}},"Update":{"OrgName":"microsoft","RepoName":"kiota","Disabled":false}} dbug: Kiota.Builder.KiotaBuilder[0] kiota version 1.15.0 dbug: Kiota.Builder.KiotaBuilder[0] cache file /tmp/kiota/cache/generation/B0C5AF71B5E0E87A7711C27ADCCF465701E7A63933C31F30D39A7E7BA86EA38B/swagger-latest.yaml is up to date and clearCache is False, using it info: Kiota.Builder.KiotaBuilder[0] loaded description from remote source trce: Kiota.Builder.KiotaBuilder[0] 17ms: Read OpenAPI file https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml dbug: Kiota.Builder.KiotaBuilder[0] step 1 - reading the stream - took 00:00:00.0196768 trce: Kiota.Builder.KiotaBuilder[0] Parsing OpenAPI file crit: Kiota.Builder.KiotaBuilder[0] error generating the client: Specified argument was out of the range of valid values. (Parameter 'source') ```

Other information

No response

@kanpov kanpov added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jun 15, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jun 15, 2024
@kanpov kanpov changed the title Libpod Spec can't be parsed Libpod (Podman REST API) spec can't be parsed Jun 15, 2024
@darrelmiller
Copy link
Member

darrelmiller commented Jun 15, 2024

This is a curious one. The OpenAPI description parses fine with our parser:

 hidi validate -d https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml
info: Microsoft.OpenApi.Hidi.Handlers.ValidateCommandHandler[0]
      => Calculating statistics
      Path Items: 165
      Operations: 173
      Parameters: 480
      Request Bodies: 33
      Responses: 173
      Links: 0
      Callbacks: 0
      Schemas: 3350

but trying to parse this with the Kiota gives the same error

kiota show -d https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml
crit: Kiota.Builder.KiotaBuilder[0]
      error showing the description: Specified argument was out of the range of valid values. (Parameter 'source')

@darrelmiller
Copy link
Member

darrelmiller commented Jun 15, 2024

This issue is caused by the use of the x-logo extension. The description you shared looks like this:

    x-logo:
        - url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png
        - altText: Podman logo

However, we were expecting an object, not an array, and we don't support altText

    x-logo:
        url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png

We recently started using x-logo in some of our own projects and unfortunately, nobody has registered the extension here. https://spec.openapis.org/registry/extension/index.html to describe what it is supposed to look like.
We also should not completely fail if the x-logo doesn't match our expected format.

Thanks for reporting this, we will work on fixing it, and getting a registration published. If someone else doesn't do it first :-)

@baywet baywet self-assigned this Jun 17, 2024
@baywet baywet added generator Issues or improvements relater to generation capabilities. and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jun 17, 2024
@baywet baywet moved this from Needs Triage 🔍 to In Progress 🚧 in Kiota Jun 17, 2024
@baywet baywet added this to the Kiota v1.16 milestone Jun 17, 2024
@baywet
Copy link
Member

baywet commented Jun 17, 2024

I authored a pull request that only adds the plugins extensions when generating plugins, this should reduce the blast radius. #4840
But the "bug" is actually in OAI.net, I opened an issue over there. microsoft/OpenAPI.NET#1695

@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Jun 18, 2024
@msgraph-bot msgraph-bot bot added the Csharp Pull requests that update .net code label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Csharp Pull requests that update .net code generator Issues or improvements relater to generation capabilities. type:bug A broken experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants