Skip to content

schema: Allow verbose no-argument actions in the settings schema - #20430

Open
Weichen Li (Weichenleeeee123) wants to merge 1 commit into
microsoft:mainfrom
Weichenleeeee123:fix/11332-schema-verbose-no-args
Open

Weichen Li (Weichenleeeee123) wants to merge 1 commit into
microsoft:mainfrom
Weichenleeeee123:fix/11332-schema-verbose-no-args

Conversation

@Weichenleeeee123

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

  • Adds a strict schema definition for verbose forms of actions that take no arguments.
  • Wires four existing optional-argument action schemas into FullCommand.command.
  • Preserves required-argument validation and rejects unexpected arguments for no-argument actions.

References and Relevant Issues

Closes #11332

Detailed Description of the Pull Request / Additional comments

Windows Terminal accepts both of these forms:

{ "command": "toggleAlwaysOnTop" }
{ "command": { "action": "toggleAlwaysOnTop" } }

The settings schema only accepted the short form because FullCommand.command
had no object branch for actions without arguments.

This adds a strict NoArgsAction definition for the 39 argument-free actions.
It also connects the existing AddMarkAction, SetFocusModeAction,
SetFullScreenAction, and SetMaximizedAction definitions, which were not
referenced by FullCommand.command.

Validation Steps Performed

Validated doc/cascadia/profiles.schema.json with PowerShell 7.6 Test-Json:

  • All 39 no-argument actions validate in verbose form.
  • Existing short forms still validate.
  • Empty and populated forms of the four optional-argument actions validate.
  • Actions missing required arguments remain invalid.
  • Unknown actions, incorrect argument types, and unexpected arguments remain invalid.
  • The schema parses successfully and git diff --check passes.

PR Checklist

@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-Schema Things that have to do with the json schema. Product-Terminal The new Windows Terminal. labels Jul 16, 2026
@Weichenleeeee123
Weichen Li (Weichenleeeee123) marked this pull request as ready for review July 16, 2026 14:54
Copilot AI review requested due to automatic review settings July 16, 2026 14:54

This comment was marked as spam.

@DHowett Dustin L. Howett (DHowett) changed the title Allow verbose no-argument actions in the settings schema schema: Allow verbose no-argument actions in the settings schema Jul 16, 2026
@Weichenleeeee123

Copy link
Copy Markdown
Contributor Author

Dustin L. Howett (@DHowett) Quick status update: I re-checked this against current main. The diff still applies cleanly, and the verbose no-argument forms ({ "action": "toggleAlwaysOnTop" }, { "action": "addMark" }, etc.) are still rejected there without this change. I'm happy to rebase if that helps review.

While doing that, I cross-referenced ALL_SHORTCUT_ACTIONS in AllShortcutActions.h against the ShortcutActionName enum in the schema. These actions are accepted by Terminal but are missing from the schema entirely, so even the short form ("command": "restartConnection") is flagged as invalid:

  • restartConnection
  • showContextMenu
  • toggleBroadcastInput
  • quickFix
  • enableReadOnlyMode
  • disableReadOnlyMode

There are also three that might be intentionally left out: breakIntoDebugger, debugTerminalCwd, and experimental.openScratchpad.

I'd like to keep this PR scoped to #11332, but I can follow up with:

  1. A small PR that adds the missing actions to the enum (and to NoArgsAction once this lands).
  2. Optionally, a check that compares the schema's action list against AllShortcutActions.h, so this list doesn't drift again. I'm not sure whether you'd want that as a script under tools/ or as part of CI, or at all.

Let me know which of these would be useful.

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

Labels

Area-Schema Things that have to do with the json schema. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema does not allow actions without arguments in verbose form

2 participants