dsc resource test result schema reference

Synopsis

The result output from the dsc resource test command.

Metadata

SchemaDialect: https://json-schema.org/draft/2020-12/schema
SchemaID:      https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/outputs/resource/test.json
Type:          object

Description

Describes the return data for a DSC Resource instance from the dsc resource get command. The return data is either a single object that describes the tested state of a non-nested instance or an array of objects that describe the tested state of the nested instances for a group or adapter resource.

DSC returns a simple test response when the instance isn't a group resource, adapter resource, or nested inside a group or adapter resource.

When the retrieved instance is for group resource, adapter resource, or nested inside a group or adapter resource, DSC returns a full test result, which also includes the resource type and instance name.

Simple test response

Required properties

The output always includes these properties:

Properties

desiredState

Represents the desired state of the resource instance. DSC validates this property's value against the resource's instance schema.

Type:     object
Required: true

actualState

Represents the actual state of the resource instance. DSC validates this property's value against the resource's instance schema.

Type:     object
Required: true

inDesiredState

Indicates whether the resource instance's properties are in the desired state. This value is true if every property is in the desired state and otherwise false.

Type:     boolean
Required: true

differingProperties

Defines the names of the properties that aren't in the desired state. If this value is an empty array, the instance's properties are in the desired state.

Type:      array
Required:  true
ItemsType: string

Full test result

Describes the return data for the full result of the test operation for a resource instance. This data is returned:

  • For every instance in a configuration document when you use the dsc config test command.
  • For nested instances of a group or adapter resource when you use the dsc resource test command.

Required properties

Properties

metadata

Defines metadata DSC returns for a configuration operation. The properties under the Microsoft.DSC property describe the context of the operation.

  • duration defines the duration of a DSC operation against a configuration document or resource instance as a string following the format defined in ISO8601 ABNF for duration. For example, PT0.611216S represents a duration of about 0.61 seconds.
Type:     object
Required: true

type

The type property identifies the instance's DSC Resource by its fully qualified type name. For more information about type names, see DSC Resource fully qualified type name schema reference.

Type:     string
Required: true
Pattern:  ^\w+(\.\w+){0,2}\/\w+$

name

The name property identifies the instance by its short, unique, human-readable name.

Type:     string
Required: true

result

The result property includes the validation state for the resource. This value is either:

  • The simple test response for the instance
  • An array of full get result objects for each nested instance, if the resource is a group or adapter resource.
Type: [object, array]
Required: true