Skip to content

lowercase CLI enum values in HelpText and error messages (Group 3)#3444

Open
souvikghosh04 wants to merge 3 commits intomainfrom
Usr/sogh/grp3-cli-casing
Open

lowercase CLI enum values in HelpText and error messages (Group 3)#3444
souvikghosh04 wants to merge 3 commits intomainfrom
Usr/sogh/grp3-cli-casing

Conversation

@souvikghosh04
Copy link
Copy Markdown
Contributor

@souvikghosh04 souvikghosh04 commented Apr 14, 2026

Summary

Fixes 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.

The JSON serialization layer already produces lowercase (via EnumMemberJsonEnumConverterFactory), so these fixes align the CLI display layer to match.

Issues Addressed

Issue Option CLI Showed Schema Requires Fix
#3361 --host-mode (init) Development or Production development or production HelpText lowercased
#3362 --rest.methods (add/update) [GET, POST, PUT, PATCH, DELETE] [get, post, put, patch, delete] HelpText lowercased
#3363 --graphql.operation (add/update) [Query, Mutation] [query, mutation] HelpText lowercased
#3364 --graphql.operation (add/update) Same as #3363 Same as #3363 Same fix

Files Changed

File Changes
src/Cli/Commands/InitOptions.cs host-mode HelpText: lowercase enum values
src/Cli/Commands/EntityOptions.cs rest.methods and graphql.operation HelpText: lowercase enum values
src/Cli/Utils.cs REST method and GraphQL operation error messages: lowercase enum names

Testing

  • Unit tests

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
@souvikghosh04 souvikghosh04 self-assigned this Apr 14, 2026
@souvikghosh04 souvikghosh04 moved this from Todo to In Progress in Data API builder Apr 14, 2026
@souvikghosh04 souvikghosh04 added this to the April 2026 milestone Apr 14, 2026
@souvikghosh04 souvikghosh04 linked an issue Apr 14, 2026 that may be closed by this pull request
4 tasks
@souvikghosh04 souvikghosh04 changed the title fix: lowercase CLI enum values in HelpText and error messages (Group 3) lowercase CLI enum values in HelpText and error messages (Group 3) Apr 16, 2026
@souvikghosh04 souvikghosh04 marked this pull request as ready for review April 16, 2026 10:41
Copilot AI review requested due to automatic review settings April 16, 2026 10:41
@souvikghosh04 souvikghosh04 moved this from In Progress to Review In Progress in Data API builder Apr 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns the DAB CLI’s --help text and certain CLI validation error messages with the JSON schema’s expected lowercase enum values, avoiding confusion when users copy/paste values into config or CLI args.

Changes:

  • Lowercase enum values displayed in dab init --help for --host-mode.
  • Lowercase enum values displayed in dab add/update --help for --rest.methods and --graphql.operation.
  • Lowercase enum values shown in CLI error messages for invalid REST method / GraphQL operation inputs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Cli/Utils.cs Lowercases supported REST/GraphQL enum values in validation error messages.
src/Cli/Commands/InitOptions.cs Updates --host-mode HelpText to show lowercase schema values.
src/Cli/Commands/EntityOptions.cs Updates --rest.methods and --graphql.operation HelpText to show lowercase schema values.

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]")]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we change the description to say we use the lowercase version of the values. Both lowercase and uppercase should be supported.
So can you just test it locally to ensure it works for both?

Copy link
Copy Markdown
Contributor

@RubenCerna2079 RubenCerna2079 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving assuming comments will be addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

CLI Incorrect Casing (Group 3)

4 participants