Skip to content

Field value validation for Microsoft.Windows.Settings #199

Open
@mdanish-kh

Description

@mdanish-kh

Brief description of your issue

I can have a configuration file as

properties:
  resources:
    - resource: Microsoft.Windows.Settings/WindowsSettings
      directives:
        allowPrerelease: true
        description: Modify Windows Settings
        securityContext: elevated
      settings:
        AppColorMode: SomethingElse # Changes to Light mode
        DeveloperMode: IcanTypeAnythingHere # Enables Developer mode
        SystemColorMode: OrHere # Change to Light mode
        TaskbarAlignment: HereAsWell # Changes to Middle
  configurationVersion: 0.2.0

Notice the values of each field under settings:

Steps to reproduce

Run the above configuration file. See the state modified.

Expected behavior

Even though the input was completely random, the configuration changes the set to "default / fallback behavior" written in the resource.

Default / fallback behavior of AppColorMode is Light mode, DeveloperMode is true, SystemColorMode is Light and TaskbarAlignment is Middle

Actual behavior

Add input validation in the resource, and don't set anything if the values do not match what we expect

Environment

Microsoft.Windows.Settings module version 0.1.0-alpha

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions