Skip to content

PS Adapter Export does not serialize enums correctly #791

@ThomasNieto

Description

@ThomasNieto

Prerequisites

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

Summary

I've added the static Export() method to my class-based resources and have Ensure as an enum. When running dsc export the enum gets converted into the numeric value instead of the string value.

$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
contentVersion: 1.0.0
resources:
- type: AnyPackageDsc/Package
  name: AnyPackageDsc/Package-0
  properties:
    result:
    - Version: 3.12.2140.44225
      Prerelease: false
      Provider: AnyPackage.Msi\Msi
      Source: C:\WINDOWS\Installer\3fc3c86b.msi
      Latest: false
      Ensure: 1
      Name: Microsoft Visual Studio Setup WMI Provider
      Reasons: null
      AdditionalParameters: {}

Steps to reproduce

Create DSC class based resource with an enum.

Expected behavior

Enums use the string value

Actual behavior

Enums use the numeric value

Error details

Environment data

7.6-preview 4

Version

3.0.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions