@@ -82,11 +82,14 @@ class PSResource {
8282 }
8383
8484 [string ] ToJson() {
85- return ($this | Select-Object - ExcludeProperty _inDesiredState | ConvertTo-Json - Compress)
85+ $retVal = ($this | Select-Object - ExcludeProperty _inDesiredState | ConvertTo-Json - Compress - EnumsAsStrings)
86+ Write-Trace - message " Serializing PSResource to JSON. Name: $ ( $this.name ) , Version: $ ( $this.version ) , Scope: $ ( $this.scope ) , RepositoryName: $ ( $this.repositoryName ) , PreRelease: $ ( $this.preRelease ) , _exist: $ ( $this._exist ) " - level trace
87+ Write-Trace - message " Serialized JSON: $retVal " - level trace
88+ return $retVal
8689 }
8790
8891 [string ] ToJsonForTest() {
89- return ($this | ConvertTo-Json - Compress - Depth 5 )
92+ return ($this | ConvertTo-Json - Compress - Depth 5 - EnumsAsStrings )
9093 }
9194}
9295
@@ -140,12 +143,17 @@ class PSResourceList {
140143 $resourceJson = " [$resourceJson ]"
141144 $jsonString = " {'repositoryName': '$ ( $this.repositoryName ) ','resources': $resourceJson }"
142145 $jsonString = $jsonString -replace " '" , ' "'
143- return $jsonString | ConvertFrom-Json | ConvertTo-Json - Compress
146+ $retVal = $jsonString | ConvertFrom-Json | ConvertTo-Json - Compress - EnumsAsStrings
147+
148+ Write-Trace - message " Serializing PSResourceList to JSON. RepositoryName: $ ( $this.repositoryName ) , TrustedRepository: $ ( $this.trustedRepository ) , Resources count: $ ( $this.resources.Count ) " - level trace
149+ Write-Trace - message " Serialized JSON: $retVal " - level trace
150+
151+ return $retVal
144152 }
145153
146154 [string ] ToJsonForTest() {
147155 Write-Trace - message " Serializing PSResourceList to JSON for test output. RepositoryName: $ ( $this.repositoryName ) , TrustedRepository: $ ( $this.trustedRepository ) , Resources count: $ ( $this.resources.Count ) " - level trace
148- $jsonForTest = $this | ConvertTo-Json - Compress - Depth 5
156+ $jsonForTest = $this | ConvertTo-Json - Compress - Depth 5 - EnumsAsStrings
149157 Write-Trace - message " Serialized JSON: $jsonForTest " - level trace
150158 return $jsonForTest
151159 }
@@ -162,6 +170,7 @@ class Repository {
162170 Repository([string ]$name ) {
163171 $this.name = $name
164172 $this._exist = $false
173+ $this.repositoryType = ' Unknown'
165174 }
166175
167176 Repository([string ]$name , [string ]$uri , [bool ]$trusted , [int ]$priority , [string ]$repositoryType ) {
@@ -185,10 +194,11 @@ class Repository {
185194 Repository([string ]$name , [bool ]$exist ) {
186195 $this.name = $name
187196 $this._exist = $exist
197+ $this.repositoryType = ' Unknown'
188198 }
189199
190200 [string ] ToJson() {
191- return ($this | ConvertTo-Json - Compress)
201+ return ($this | ConvertTo-Json - Compress - EnumsAsStrings )
192202 }
193203}
194204
0 commit comments