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

Suggestion for Enum name cleanup logic #2495

Open
vadrsa opened this issue Mar 31, 2023 · 1 comment
Open

Suggestion for Enum name cleanup logic #2495

vadrsa opened this issue Mar 31, 2023 · 1 comment
Labels
enhancement New feature or request generator Issues or improvements relater to generation capabilities.
Milestone

Comments

@vadrsa
Copy link

vadrsa commented Mar 31, 2023

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"
],
"enum": [
    "kiota:chsarp:enum",
    "kiota:csharp:class",
    "kiota:java:enum",
    "kiota:java:class"
],
"enum": [
    "ENABLED",
    "DISABLED",
],
"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.

@baywet baywet self-assigned this Mar 31, 2023
@baywet baywet added enhancement New feature or request generator Issues or improvements relater to generation capabilities. labels Mar 31, 2023
@baywet baywet added this to Kiota Mar 31, 2023
@github-project-automation github-project-automation bot moved this to Todo in Kiota Mar 31, 2023
@baywet baywet added this to the Kiota v2 milestone Mar 31, 2023
@baywet
Copy link
Member

baywet commented Mar 31, 2023

Thanks for the suggestion.
Unfortunately this is not something that we can fix before the next major version of Kiota.
The rationale is the same as the one provided here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request generator Issues or improvements relater to generation capabilities.
Projects
Status: New📃
Development

No branches or pull requests

3 participants