microsoft / microsoft/kiota

Suggestion for Enum name cleanup logic

Open
#2,495 1 comment 0 reactions 0 assignees View on GitHub
enhancement generator
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

Currently Enum name cleanup follows the same naming cleanup logic as classes for example, meaning invalid characters like ':' are just removed.
But Enum names are generally important to keep as defined in the OpenAPI spec and Kiota shouldn't take much responsability on itself to change the names defined in the specification. The only motivation for change could be to remove or replace invalid characters. Here are a few examples for discussion
1.
```
"enum": [
"KIOTA:CSHARP:ENUM",
"KIOTA:CSHARP:CLASS",
"KIOTA:JAVA:ENUM",
"KIOTA:JAVA:CLASS"
],
```
2.
```
"enum": [
"kiota:chsarp:enum",
"kiota:csharp:class",
"kiota:java:enum",
"kiota:java:class"
],
```
3.
```
"enum": [
"ENABLED",
"DISABLED",
],
```
4.
```
"enum": [
"enabled",
"disabled",
],
```

In example 1, the invalid characters should be replaced with _, as doing anything else requires changing the case of the whole name to keep the visual separation and namespacing and it quickly becomes an impossible logic. Keeping the uppercase naming in this example is a good idea.
In example 2, again the invalid characters should be replaced with _. Also, here its good idea to keep the lowercase naming.
In example 3, the names could be transformed to pascal case but it could also stay the same, so that the cleanup logic could be kept the same.
In example 4, the names could be transformed to pascal case but it could also stay the same, so that the cleanup logic could be kept the same.

Contributor guide

Open the contributing guide

Research direction

Start by locating Kiota's enum name cleanup logic and compare it with the class naming cleanup behavior described in the issue. Resolve the intended treatment of case and invalid characters for the four examples, then add coverage demonstrating the agreed enum names.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.