Closed ghost closed 2 years ago
Hi @jgardsentry,
Good morning.
Thanks for reporting the issue. I checked the Get-PLSProduct Cmdlet documentation, the examples posted there also indicate the response as JSON. So this doesn't appear to be a bug. Also, not sure if this is a feature-request
since any change to the response type could break other customers. Hope this provides some guidance.
Thanks, Ashish
Thank you @ashishdhingra . Good point. I would suggest that a Powershell developer is going to expect responses to to be in usable objects, not in strings. We can call it a bug or feature request, but I do think the current behavior is entirely inconsistent with how everything else in Powershell works.
I understand the concern about backward compatibility. A simple workaround could be to just add something like a -ReturnObjects
switch that does the JSON conversion for the user. Ultimately, I do think there should be a timeline to deprecate the current behavior and switch to returning objects by default.
@jgardsentry Thanks for your reply. I agree it should be consistent and don't have context on why it's the behavior since quite long. I will mark this as feature-request
so that this default behavior could be reviewed.
Thanks for posting this @jgardsentry, FWIW - I had to use Get-PLSProduct cmdlet in a PowerShell script context and definitely found that JSON string returning from it is odd (and unusable as-is, which indeed forced me to pipe the output to ConvertFrom-Json to do my further processing).
PowerShell is Object-Oriented by nature (and design), and this should be taken into account when designing and developing cmdlets for it.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
Description
Get-PLSProduct
returns JSON string objects, not proper Powershell objects. This requires the client toConvertFrom-Json
the results.Reproduction Steps
Logs
Environment
(Same behavior also in 7.0.3 core with AWS.Tools.* v4.1.3.0)
$PSVersionTable
Resolution
At a minimum, adding
| ConvertFrom-JSON
to the objects as they're returning would work.This is a :bug: bug-report