-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ConvertTo-Csv / Export-Csv - Serialize IDictionary objects with key/value pairs as properties #11029
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
Conversation
src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Csv.Tests.ps1
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
Outdated
Show resolved
Hide resolved
Added a doc issue for these changes. 😊 |
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Csv.Tests.ps1
Outdated
Show resolved
Hide resolved
@SteveL-MSFT please update your review when you have a moment 💖 😊 |
@vexx32 is there any chance to complete this for the 7.1 preview? |
@mi-hol the code here is as functional as it gets. ^^ I'll rebase the commits to take care of the merge conflict and ensure that everything works as expected, but whether it makes the 7.1-preview release is entirely up the other folks here, I'm afraid. 🙂 /cc @SteveL-MSFT |
59919fd
to
f130cd2
Compare
@SteveL-MSFT could you please update your review? Thanks! 😊 |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@SteveL-MSFT Could you please review or delegate this anybody? |
@TravisEz13 last change 'remove label' applied by bot seems incorrect. |
@SteveL-MSFT friendly ping for review. 😊 |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@vexx32 Please rebase to update CIs. |
- Add tests for ConvertTo-Csv Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs Co-Authored-By: Ilya <darpa@yandex.ru> Update test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Csv.Tests.ps1
f130cd2
to
2397ca0
Compare
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@iSazonov I think this one is ready |
/azp run |
Azure Pipelines successfully started running 5 pipeline(s). |
🎉 Handy links: |
🎉 Handy links: |
PR Summary
With this change, the behaviour for
IDictionary
inputs are changed inConvertTo-Csv
andExport-Csv
:InputObject
is notIDictionary
, behaviour remains as per existing behaviour.InputObject
isIDictionary
:Keys
and any additional instance properties (e.g., those added withAdd-Member
orSelect-Object
)The reason we also check for any instance properties is based on the assumption that if a user is adding extra properties to their IDictionary objects, they likely want to keep them as intact as possible.
We do however ignore standard properties completely, since with IDictionary objects these are typically of little value when serialized to string.
Note that since both Export-Csv and ConvertTo-Csv utilise the same helper methods, tests were only added to the ConvertTo-Csv test file in order to minimise the duplication of code.
Example
PR Context
Resolves #10999
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.