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

Child path/RequestBuilder with same name as parent not reachable in generated C# client #4831

Closed
CocoDico78 opened this issue Jun 14, 2024 · 2 comments · Fixed by #5509
Closed
Assignees
Labels
Csharp Pull requests that update .net code type:bug A broken experience WIP
Milestone

Comments

@CocoDico78
Copy link

CocoDico78 commented Jun 14, 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 client code with Kiota 1.15.0 for this openAPI document:

{
  "openapi": "3.0.0",
  "info": {
    "title": "Sample API with repeated paths",
    "version": "1.0.0"
  },
  "paths": {
    "/sample/sample": {
      "get": {
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}

but the generated code looks like

namespace ApiSdk.Sample;
public class SampleRequestBuilder : BaseRequestBuilder
{
    // Returns an instance of itself instead of the nested RequestBuilder... It is missing an extra "Sample" in the namespace
    public ApiSdk.Sample.SampleRequestBuilder Sample => new ApiSdk.Sample.SampleRequestBuilder(PathParameters, RequestAdapter);
    // [...]
}

Expected behavior

Generated code should look like

namespace ApiSdk.Sample;
public class SampleRequestBuilder : BaseRequestBuilder
{
    public ApiSdk.Sample.Sample.SampleRequestBuilder Sample => new ApiSdk.Sample.Sample.SampleRequestBuilder(PathParameters, RequestAdapter);
    // [...]
}

(notice the extra Sample namespace)

How to reproduce

Run kiota generate -l CSharp -d ./definition_problematic.json -o ./Client

Or see repro repository here.

Open API description file

definition_problematic.json

Kiota Version

1.15.0+b535a94064cd8c14a022aaba42964467d5db525a

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

No response

Known Workarounds

I have to go in after generation and manually append the missing namespace segments.

Configuration

No response

Debug output

No response

Other information

No response

@CocoDico78 CocoDico78 added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jun 14, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jun 14, 2024
@baywet baywet removed the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Jun 17, 2024
@baywet baywet moved this from Needs Triage 🔍 to Todo 📃 in Kiota Jun 17, 2024
@baywet baywet added this to the Backlog milestone Jun 17, 2024
@baywet baywet added the Csharp Pull requests that update .net code label Jun 17, 2024
@baywet
Copy link
Member

baywet commented Jun 17, 2024

Thanks for reporting this. Potentially related #4814 and #4796

@andrueastman
Copy link
Member

Similar issues reported at #5462.
This should be fixed with #5509

@andrueastman andrueastman self-assigned this Oct 1, 2024
@github-project-automation github-project-automation bot moved this from Todo 📃 to Done ✔️ in Kiota Oct 1, 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 type:bug A broken experience WIP
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants