From f66d82dbf2d4514b9b471fa1730177e4ea6bfa2d Mon Sep 17 00:00:00 2001 From: souvikghosh04 Date: Tue, 14 Apr 2026 17:22:26 +0530 Subject: [PATCH] fix: lowercase CLI enum values in HelpText and error messages (Group 3) Fix 4 issues where CLI help text and error messages showed PascalCase or uppercase enum values instead of the lowercase values required by the JSON schema: InitOptions.cs: - host-mode HelpText: 'Development or Production' -> 'development or production' (#3361) EntityOptions.cs: - rest.methods HelpText: '[GET, POST, ...]' -> '[get, post, ...]' (#3362) - graphql.operation HelpText: '[Query, Mutation]' -> '[query, mutation]' (#3363, #3364) Utils.cs: - REST method error message: Enum.GetNames() -> lowercased names - GraphQL operation error message: enum ToString() -> lowercased strings --- src/Cli/Commands/EntityOptions.cs | 4 ++-- src/Cli/Commands/InitOptions.cs | 2 +- src/Cli/Utils.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Cli/Commands/EntityOptions.cs b/src/Cli/Commands/EntityOptions.cs index 3b2b77d9b2..fc423337a2 100644 --- a/src/Cli/Commands/EntityOptions.cs +++ b/src/Cli/Commands/EntityOptions.cs @@ -83,13 +83,13 @@ public EntityOptions( [Option("rest", Required = false, HelpText = "Route for rest api.")] public string? RestRoute { get; } - [Option("rest.methods", Required = false, Separator = ',', HelpText = "HTTP actions to be supported for stored procedure. Specify the actions as a comma separated list. Valid HTTP actions are : [GET, POST, PUT, PATCH, DELETE]")] + [Option("rest.methods", Required = false, Separator = ',', HelpText = "HTTP actions to be supported for stored procedure. Specify the actions as a comma separated list. Valid HTTP actions are: [get, post, put, patch, delete]")] public IEnumerable? RestMethodsForStoredProcedure { get; } [Option("graphql", Required = false, HelpText = "Type of graphQL.")] public string? GraphQLType { get; } - [Option("graphql.operation", Required = false, HelpText = $"GraphQL operation to be supported for stored procedure. Valid operations are : [Query, Mutation] ")] + [Option("graphql.operation", Required = false, HelpText = "GraphQL operation to be supported for stored procedure. Valid operations are: [query, mutation]")] public string? GraphQLOperationForStoredProcedure { get; } [Option("fields.include", Required = false, Separator = ',', HelpText = "Fields that are allowed access to permission.")] diff --git a/src/Cli/Commands/InitOptions.cs b/src/Cli/Commands/InitOptions.cs index b44fd8d15e..0d3f8f7824 100644 --- a/src/Cli/Commands/InitOptions.cs +++ b/src/Cli/Commands/InitOptions.cs @@ -90,7 +90,7 @@ public InitOptions( [Option("set-session-context", Default = false, Required = false, HelpText = "Enable sending data to MsSql using session context.")] public bool SetSessionContext { get; } - [Option("host-mode", Default = HostMode.Production, Required = false, HelpText = "Specify the Host mode - Development or Production")] + [Option("host-mode", Default = HostMode.Production, Required = false, HelpText = "Specify the Host mode - development or production")] public HostMode HostMode { get; } [Option("cors-origin", Separator = ',', Required = false, HelpText = "Specify the list of allowed origins.")] diff --git a/src/Cli/Utils.cs b/src/Cli/Utils.cs index c1ff7f2a99..4263728405 100644 --- a/src/Cli/Utils.cs +++ b/src/Cli/Utils.cs @@ -602,7 +602,7 @@ public static bool TryConvertRestMethodNameToRestMethod(string? method, out Supp { if (!Enum.TryParse(method, ignoreCase: true, out restMethod)) { - _logger.LogError("Invalid REST Method. Supported methods are {restMethods}.", string.Join(", ", Enum.GetNames())); + _logger.LogError("Invalid REST Method. Supported methods are {restMethods}.", string.Join(", ", Enum.GetNames().Select(n => n.ToLowerInvariant()))); return false; } @@ -652,8 +652,8 @@ public static bool TryConvertGraphQLOperationNameToGraphQLOperation(string? oper { _logger.LogError( "Invalid GraphQL Operation. Supported operations are {queryName} and {mutationName}.", - GraphQLOperation.Query, - GraphQLOperation.Mutation); + nameof(GraphQLOperation.Query).ToLowerInvariant(), + nameof(GraphQLOperation.Mutation).ToLowerInvariant()); return false; }