Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error message for PowerShell adapter without input #517

Closed
wants to merge 6 commits into from

Conversation

Gijsreyn
Copy link
Contributor

@Gijsreyn Gijsreyn commented Aug 7, 2024

PR Summary

The PowerShell adapter requires a check whenever input is empty, it should return a proper error message. In this case, the default @{} was given as a parameter without converting it to JSON. Now it checks the JSON input and if empty, converts it still to an empty JSON string.

@Gijsreyn
Copy link
Contributor Author

Gijsreyn commented Aug 7, 2024

@anmenaga Can you review this PR? It's a small one.

@@ -66,6 +66,11 @@ if ($jsonInput) {
if ($jsonInput -ne '@{}') {
$inputobj_pscustomobj = $jsonInput | ConvertFrom-Json
}
else
{
$jsonInput = $jsonInput | ConvertTo-Json
Copy link
Contributor

@anmenaga anmenaga Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused about the problem this PR is trying to fix; Can you please give examples of expected behavior and actual behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever a user tries to do a get operation on a resource without specifying any input, it should give a proper error message to the user. That's it actually. If it can be captured higher level, that would also do the trick.

@anmenaga
Copy link
Contributor

A generic fix for this issue is in #525 .

@anmenaga anmenaga closed this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants