Skip to content

Parameter null value is not allowed #1000

@Gijsreyn

Description

@Gijsreyn

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

While developing the coalesce function and writing the documentation, I stumbled on the following error from example 3:

Parser: Parameter 'customValue' not found in context.

It looks like parameter default values set to null are not allowed.

Steps to reproduce

Run the following example from the branch comparison-function-coalesce:

$in = @'
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
parameters:
  customValue:
    type: string
    defaultValue: null
  timeout:
    type: int
    defaultValue: 0
resources:
- name: Configuration with fallbacks
  type: Microsoft.DSC.Debug/Echo
  properties:
    output:
      configValue: "[coalesce(parameters('customValue'), 'default-config')]"
      timeout:     "[coalesce(parameters('timeout'), 30)]"
'@
dsc config get --input $in

Expected behavior

The example would have returned null on `configValue`

Actual behavior

The error: Parser: Parameter 'customValue' not found in context occurs

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

dsc 3.2.0-preview.3

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions