microsoft / microsoft/kiota

Complete PascalCase transformation for C# clients

Open
#4,699 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### Is your feature request related to a problem? Please describe the problem.

Hello,

I used Kiota to generate a C# api client out of a Django openapi specification. It unfortunately still generates quite some PascalCase/snake_case mixtures in naming.

Example specification:
`{
"openapi": "3.0.0",
"info": {
"title": "Sample Users API",
"description": "This API manages user information with more explicitly snake_case paths",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.sample.com/v1",
"description": "Primary production server"
}
],
"paths": {
"/users/user_details/{user_id}": {
"get": {
"summary": "Retrieve specific user details",
"description": "Fetches details of a specific user by user ID",
"operation_id": "get_specific_user_details",
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"description": "The unique identifier for the user",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful response with user details",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"user_id": {
"type": "integer",
"description": "Unique identifier for the user"
},
"user_name": {
"type": "string",
"description": "The user's name"
}
}
}
}
}
}
}
}
},
"/users/{user_id}/update_role": {
"post": {
"summary": "Update a user's role",
"description": "Updates the role of a specific user by user ID",
"operation_id": "update_user_role",
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"description": "The unique identifier for the user",
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"new_role": {
"type": "string",
"enum": [
"admin_role",
"user_role",
"guest_role"
],
"description": "The new role of the user"
}
},
"required": [
"new_role"
]
}
}
}
},
"responses": {
"200": {
"description": "Role updated successfully"
},
"400": {
"description": "Invalid input provided"
}
}
}
}
}
}`

Folders & Classes in snake_case:
image

Namespaces:
image

Properties, inner classes:
image

Enums and enum-values:
image

Perhaps there are more scenarios. I tried to fix it myself but with the time I have the C# refiner class is too complicated to add changes to.

### Client library/SDK language

Csharp

### Describe the solution you'd like

It would be great to have the C# refiner Class extended with more snake_case to PascalCase renaming

### Additional context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C# refiner class and generate a client from the supplied OpenAPI example to inventory the remaining snake_case names. Extend the refiner so folders, classes, namespaces, properties, inner classes, enums, and enum values consistently use PascalCase, then verify the generated output against these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.