terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Profiles Schema: "name" in a profile is required when its not

Open skrysm opened this issue 7 years ago • 5 comments

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.356]
Windows Terminal version (if applicable): 0.5.2681.0

Any other software?
Visual Studio Code: 1.38.1

Steps to reproduce

  1. Open profiles.json in Visual Studio Code
  2. In one of the profiles remove the name property (i.e. to have it use the name it inherits from the defaults.json).

Expected behavior

I should not get a schema warning.

Actual behavior

I'm getting the following schema warning:

Missing property "name".

skrysm avatar Sep 29 '19 06:09 skrysm

This one's tricky. The defaults don't need a name, that's correct, because they already have a name set in the defaults.json. However, every other profile will still require a name.

I'm leaning towards leaving it marked required, but I'm open to ideas.

cc @cinnamon-msft @DHowett-MSFT @bitcrazed

zadjii-msft avatar Sep 30 '19 13:09 zadjii-msft

I see. I mean you could make the name actually optional. If none is provided, fall back to the command line for the profile's name (e.g. powershell.exe) and if this property is missing too, use the profile's guid.

skrysm avatar Sep 30 '19 15:09 skrysm

Unfortunately, GUID is also optional (now) and commandline isn’t required for all types of connections. Still, worth investigating a third form of primary key material...

DHowett-MSFT avatar Sep 30 '19 16:09 DHowett-MSFT

Discussion from triage: except in very narrow circumstances, name is required. The Terminal will want to pop a warning dialog if you omit it.

DHowett-MSFT avatar Sep 30 '19 21:09 DHowett-MSFT

So unfortunately, the schema isn't flexible enough to capture how Terminal parses its settings, specifically how the name property might be provided from another source (like defaults.json) when you haven't specified one in your settings file. In the future post v1 when we land a settings UI, this should be less of an issue because we'll have more nuanced control of how a user's settings are composed! For now though, we'd like to keep the current behavior where it'll give you a schema warning because we believe that name is recommended even if it isn't technically required and won't break if you don't have one.

leonMSFT avatar Apr 21 '20 21:04 leonMSFT