File tree Expand file tree Collapse file tree 9 files changed +56
-13
lines changed
Expand file tree Collapse file tree 9 files changed +56
-13
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,11 @@ $Manifest = @{
6161 ReleaseNotes = ' https://github.com/okta/okta-powershell-cli/releases'
6262
6363
64- ModuleVersion = ' 1.0.0 '
64+ ModuleVersion = ' 1.0.1 '
6565
6666
6767 RootModule = ' Okta.PowerShell.psm1'
68- Guid = ' {AD0CD253-16DF-4496-9BCF-EA49AFB7FB27 }' # Has to be static, otherwise each new build will be considered different module
68+ Guid = ' {7DA80DEB-6F4C-43CB-97CF-05CCE8B73473 }' # Has to be static, otherwise each new build will be considered different module
6969
7070 PowerShellVersion = ' 6.2'
7171
Original file line number Diff line number Diff line change @@ -200,7 +200,12 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
200200 -UserAgent $OktaUserAgent
201201 }
202202
203- $Response = DeserializeResponse -Response $RawResponse.Content -ReturnType $ReturnType -ContentTypes $RawResponse.Headers["Content-Type"]
203+ $Response = $null
204+
205+ if ($RawResponse.StatusCode -ne '204') {
206+ $Response = DeserializeResponse -Response $RawResponse .Content -ReturnType $ReturnType -ContentTypes $RawResponse .Headers[" Content-Type" ]
207+ }
208+
204209 $StatusCode = $RawResponse.StatusCode
205210 $Headers = $RawResponse.Headers
206211 $ElapsedTimeInMilliseconds = CalculateElapsedTime -StartTime $StartTime
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ function Remove-NullProperties {
1919 $NewObject = Remove-NullPropertiesFromHashMap($InputObject )
2020 }
2121 elseif ($InputObject -is [array]){
22- $NewObject = Remove-NullPropertiesFromArray($InputObject )
22+ [array]$NewArray = Remove-NullPropertiesFromArray($InputObject )
23+ return $NewArray
2324 }
2425 else{
2526 $PropertyList = $InputObject .PSObject.Properties | Where-Object { $null -ne $_ .Value }
@@ -46,7 +47,13 @@ function Remove-NullPropertiesFromHashMap{
4647 $OutputHashtable = @{}
4748 foreach ($Key in $InputObject.Keys) {
4849 $Value = $InputObject [$Key ]
49- $CleanedValue = Remove-NullProperties $Value
50+ # explicit cast to avoid arrays to be converted to object (i.e @(' foo' ))
51+ if ($Value -is [array]){
52+ [array]$CleanedValue = Remove-NullProperties $Value
53+ } else{
54+ $CleanedValue = Remove-NullProperties $Value
55+ }
56+
5057 if ($null -ne $CleanedValue) {
5158 $OutputHashtable [$Key ] = $CleanedValue
5259 }
Original file line number Diff line number Diff line change 1414 "templateDir" : " ./codegen-templates" ,
1515 "outputDir" : " ../" ,
1616 "inputSpec" : " ./management.yaml" ,
17- "packageVersion" : " 1.0.0 " ,
17+ "packageVersion" : " 1.0.1 " ,
1818 "packageDescription" : " Official PowerShell CLI for the Okta API" ,
1919 "packageTitle" : " Official PowerShell for the Okta API" ,
2020 "packageCompany" : " Okta, Inc." ,
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ function Remove-NullProperties {
2626 $NewObject = Remove-NullPropertiesFromHashMap ($InputObject )
2727 }
2828 elseif ($InputObject -is [array ]){
29- $NewObject = Remove-NullPropertiesFromArray ($InputObject )
29+ [array ]$NewArray = Remove-NullPropertiesFromArray ($InputObject )
30+ return $NewArray
3031 }
3132 else {
3233 $PropertyList = $InputObject.PSObject.Properties | Where-Object { $null -ne $_.Value }
@@ -53,7 +54,13 @@ function Remove-NullPropertiesFromHashMap{
5354 $OutputHashtable = @ {}
5455 foreach ($Key in $InputObject.Keys ) {
5556 $Value = $InputObject [$Key ]
56- $CleanedValue = Remove-NullProperties $Value
57+ # explicit cast to avoid arrays to be converted to object (i.e @('foo'))
58+ if ($Value -is [array ]){
59+ [array ]$CleanedValue = Remove-NullProperties $Value
60+ }else {
61+ $CleanedValue = Remove-NullProperties $Value
62+ }
63+
5764 if ($null -ne $CleanedValue ) {
5865 $OutputHashtable [$Key ] = $CleanedValue
5966 }
Original file line number Diff line number Diff line change 33#
44# Generated by: Okta, Inc.
55#
6- # Generated on: 2024-02-27
6+ # Generated on: 2024-03-25
77#
88
99@ {
@@ -18,7 +18,7 @@ ModuleVersion = '1.0.0'
1818CompatiblePSEditions = ' Core'
1919
2020# ID used to uniquely identify this module
21- GUID = ' ad0cd253-16df-4496-9bcf-ea49afb7fb27 '
21+ GUID = ' bc068b08-7d7f-4819-aa50-a40989920d49 '
2222
2323# Author of this module
2424Author = ' Okta, Inc.'
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ function Invoke-OktaApiClient {
131131 }
132132 }
133133
134- $OktaUserAgent = [Microsoft.PowerShell.Commands.PSUserAgent ]::Chrome + " okta-powershell-module/1.0.0 "
134+ $OktaUserAgent = [Microsoft.PowerShell.Commands.PSUserAgent ]::Chrome + " okta-powershell-module/1.0.1 "
135135
136136
137137 # Setting up vars for retry
@@ -188,7 +188,12 @@ function Invoke-OktaApiClient {
188188 - UserAgent $OktaUserAgent
189189 }
190190
191- $Response = DeserializeResponse - Response $RawResponse.Content - ReturnType $ReturnType - ContentTypes $RawResponse.Headers [" Content-Type" ]
191+ $Response = $null
192+
193+ if ($RawResponse.StatusCode -ne ' 204' ) {
194+ $Response = DeserializeResponse - Response $RawResponse.Content - ReturnType $ReturnType - ContentTypes $RawResponse.Headers [" Content-Type" ]
195+ }
196+
192197 $StatusCode = $RawResponse.StatusCode
193198 $Headers = $RawResponse.Headers
194199 $ElapsedTimeInMilliseconds = CalculateElapsedTime - StartTime $StartTime
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ LONG DESCRIPTION
1010 This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
1111
1212 - API version: 3.0.0
13- - SDK version: 1.0.0
13+ - SDK version: 1.0.1
1414 - Build package: org.openapitools.codegen.languages.PowerShellClientCodegen
1515 For more information, please visit [https://developer.okta.com/](https://developer.okta.com/)
1616
Original file line number Diff line number Diff line change @@ -44,4 +44,23 @@ Context 'Remove-NullProperties' {
4444 Get-Member - inputobject $CleanedJsonObject.details.children [0 ] - name " age" - MemberType Properties | Should - Be $null
4545 Get-Member - inputobject $CleanedJsonObject.details.children [0 ] - name " name" - MemberType Properties | Should - Be -Not $null
4646 }
47+
48+ It ' Should maintain the same object when there'' s no null values' {
49+ $NewGroupRule = [PSObject ]@ {
50+ name = " Assign users to the Sales Team"
51+ type = " group_rule"
52+ actions = [PSObject ]@ {
53+ assignUserToGroups = [PSObject ]@ {
54+ groupIds = [array ]@ (' foo' )
55+ }
56+ }
57+ }
58+
59+ $CleanedRule = Remove-NullProperties $NewGroupRule
60+
61+ $CleanedRule.name | Should - Be " Assign users to the Sales Team"
62+ $CleanedRule.type | Should - Be " group_rule"
63+ $CleanedRule.actions.assignUserToGroups.groupIds.Count | Should - Be 1
64+ $CleanedRule.actions.assignUserToGroups.groupIds [0 ] | Should - Be " foo"
65+ }
4766}
You can’t perform that action at this time.
0 commit comments