From f61c1da943de1be0590cd1476c59154fd9c33ebf Mon Sep 17 00:00:00 2001 From: Boshi LIAN Date: Sat, 27 Apr 2024 16:22:41 -0700 Subject: [PATCH] fix csharp naming conflict --- .../GeneralNameHelper.cs | 82 +++++++++---------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/src/LibKubernetesGenerator/GeneralNameHelper.cs b/src/LibKubernetesGenerator/GeneralNameHelper.cs index 16616bafa..c9b5cf5af 100644 --- a/src/LibKubernetesGenerator/GeneralNameHelper.cs +++ b/src/LibKubernetesGenerator/GeneralNameHelper.cs @@ -78,57 +78,51 @@ public string GetDotNetName(string jsonName, string style = "parameter") switch (style) { case "parameter": - if (jsonName == "namespace") + switch (jsonName) { - return "namespaceParameter"; - } - else if (jsonName == "continue") - { - return "continueParameter"; + case "namespace": + return "namespaceParameter"; + case "continue": + return "continueParameter"; + default: + break; } break; case "fieldctor": - if (jsonName == "namespace") - { - return "namespaceProperty"; - } - else if (jsonName == "continue") - { - return "continueProperty"; - } - else if (jsonName == "$ref") - { - return "refProperty"; - } - else if (jsonName == "default") - { - return "defaultProperty"; - } - else if (jsonName == "operator") - { - return "operatorProperty"; - } - else if (jsonName == "$schema") - { - return "schema"; - } - else if (jsonName == "enum") - { - return "enumProperty"; - } - else if (jsonName == "object") - { - return "objectProperty"; - } - else if (jsonName == "readOnly") - { - return "readOnlyProperty"; - } - else if (jsonName == "from") + + switch (jsonName) { - return "fromProperty"; + case "namespace": + return "namespaceProperty"; + case "continue": + return "continueProperty"; + case "$ref": + return "refProperty"; + case "default": + return "defaultProperty"; + case "operator": + return "operatorProperty"; + case "$schema": + return "schema"; + case "enum": + return "enumProperty"; + case "object": + return "objectProperty"; + case "readOnly": + return "readOnlyProperty"; + case "from": + return "fromProperty"; + case "int": + return "intValue"; + case "bool": + return "boolValue"; + case "string": + return "stringValue"; + + default: + break; } if (jsonName.Contains("-"))