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

Kiota fails when creating a plugin for https://api.github.com/ GET operation #5300

Closed
maisarissi opened this issue Sep 2, 2024 · 8 comments · Fixed by #5344
Closed
Assignees
Labels
type:bug A broken experience WIP
Milestone

Comments

@maisarissi
Copy link
Contributor

What are you generating using Kiota, clients or plugins?

Kiota plugin

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

None

Describe the bug

When trying to create a plugin for https://api.github.com/ #GET operation:

"paths": {
    "/": {
      "get": {
        "summary": "GitHub API Root",
        "description": "Get Hypermedia links to resources accessible in GitHub's REST API",
        "tags": [
          "meta"
        ],
        "operationId": "meta/root",
        "responses": {
          "200": {
            "description": "Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/root"
                },
                "examples": {
                  "default": {
                    "$ref": "#/components/examples/root"
                  }
                }
              }
            }
          }
        },
        "x-github": {
          "githubCloudOnly": false,
          "enabledForGitHubApps": true,
          "category": "meta",
          "subcategory": "meta"
        },
        "externalDocs": {
          "description": "API method documentation",
          "url": "https://docs.github.com/rest/meta/meta#github-api-root"
        }
      }
    }

I'm getting the following error:
image

The error message is talking about client and I'm trying to create a plugin.

Also, I can call the endpoint and get data back with no errors:
image

Expected behavior

The expectation is to successfully create a plugin.

How to reproduce

Try to create a plugin for https://api.github.com/ #GET operation.

Open API description file

No response

Kiota Version

1.18.100000001 (main branch)

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

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@maisarissi maisarissi added type:bug A broken experience status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Sep 2, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Sep 2, 2024
@andrueastman
Copy link
Member

This error is thrown by the OpenApi library at https://github.com/microsoft/OpenAPI.NET/blob/da3dfd9dc2d67359576606c6ba45783434c207c2/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs#L396

We will need to confirm if the issue here is the input supplied by Kiota.

@andrueastman andrueastman moved this from Needs Triage 🔍 to Todo 📃 in Kiota Sep 4, 2024
@andrueastman andrueastman removed the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Sep 4, 2024
@baywet
Copy link
Member

baywet commented Sep 4, 2024

This is ultimately caused by calling this method with request urls

var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: doc);

For the root URL, we might need to special case the URL we're providing.

@andrueastman
Copy link
Member

andrueastman commented Sep 5, 2024

clarifying question for @maisarissi

Do you pass the filter option as #GET or as /#GET? Does the inverse work out?

According to #5344 using /GET should lead to non-zero paths on filtering.

We may also need to confirm what input the extension is sending if this scenario is seen on that end....

@maisarissi
Copy link
Contributor Author

maisarissi commented Sep 5, 2024

I haven't tried using the CLI. I tried only using the VS Code extension, so the problem might be how the extension is passing the filter option?

I see 2 errors from a VS Code extension lens:
1 - The error message needs to be refactored as we are saying: "error adding the client". The error can occur for both client and plugin generation.
2 - The extension should send the right filter to create the client/plugin

@andrueastman
Copy link
Member

Can confirm the extension is sending the filter argument as #GET. From the original description I thought this was ran from the nuget tool.

1 - The error message needs to be refactored as we are saying: "error adding the client". The error can occur for both client and plugin generation.

+1 on this. We should probably validate the requestUrls collection in non empty before calling this on the service.

var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: doc);

@andrueastman andrueastman self-assigned this Sep 6, 2024
@github-project-automation github-project-automation bot moved this from Todo 📃 to Done ✔️ in Kiota Sep 6, 2024
@baywet baywet modified the milestones: Kiota v1.19, Kiota v1.18.1 Sep 6, 2024
@fey101
Copy link
Contributor

fey101 commented Sep 11, 2024

Issue isn't yet fixed for the github root GET node. See #5384. Duplicate issue opened after this issue was marked as closed.

@fey101 fey101 reopened this Sep 11, 2024
@github-project-automation github-project-automation bot moved this from Done ✔️ to In Progress 🚧 in Kiota Sep 11, 2024
@andrueastman
Copy link
Member

@fey I believe the change/fix in #5344 was made after the 1.8.0 release.
To validate we would need to use the head of the main branch for or the next preview as #5384 is using the 1.8.0 release.

Any chance you can validate and confirm?

@fey101 fey101 closed this as completed Sep 11, 2024
@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Sep 11, 2024
@fey
Copy link

fey commented Sep 12, 2024

To validate we would need to use the head of the main branch for or the next preview as https://github.com/microsoft/kiota/issues/5384 is using the 1.8.0 release.

Any chance you can validate and confirm?

I think it is for @fey101

@baywet baywet modified the milestones: Kiota v1.18.1, Kiota v1.19 Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A broken experience WIP
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants