Skip to content

CSharp Generator Changing Namespace Casing #6561

Open
@JoesGab

Description

@JoesGab

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

The dotnet tool for CSharp generation is currently converting a given namespace to PascalCasing and also inserting extra folders in the output.

Expected behavior

Personally I feel the tool should just acknowledge the given casing of the namespace and not touch it. Also, according to the Names of Namespaces, it is not uncommon to have special cased Namespaces, e.g. for brands.

The extra folders are furthermore conflicting with the namespace and should not be there.

How to reproduce

Executing the code from makesdk.bat in the sample-api as is, yields the following output:

Image

If we change the content of the bat from this:

kiota generate -l CSharp -c ToDoApiClient -n ToDoClient.ApiClient -d https://localhost:7206/openapi/openapi.yaml -o ./src/Client

to this (note the camelCase namespace toDoClient.ApiClient):

kiota generate -l CSharp -c ToDoApiClient -n toDoClient.ApiClient -d https://localhost:7206/openapi/openapi.yaml -o ./src/Client

it yields the following output, while also changing the namespace casing to ToDoClient.ApiClient:

Image

Open API description file

No response

Kiota Version

1.26.0+dd06afb176dd502bb75cefa5c024d7347263b53c

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_

Metadata

Metadata

Assignees

Labels

CsharpPull requests that update .net codestatus:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

Type

No type

Projects

Status

Needs Triage 🔍

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions