PowerShell / PowerShell/PowerShell-RFC

ConvertFrom/To-Hashtable and/or ConvertTo-PSCustomObject cmdlets

Offen
#159 5 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Up-for-Grabs
Vorherrschende Sprache
PowerShell
Sterne
467
Forks
140
Ø Merge
9 Min.
Gemergte PRs (30 T.)
1

Beschreibung

Related discussion in #109, specifically this comment:

Finally got around to reviewing this with @PowerShell/powershell-committee.

It sounds like the problem that's being solved here is to convert nested hashtables to PSCustomObjects when the keys are all strings (when they're not strings, conversion will likely result in key collision due to ToString() returning type names).

To that end, we think it's more generically useful to build a ConvertFrom-Hashtable cmdlet that would allow more generic and custom conversion of hashtables to PSCustomObjects and potentially other types using constructors that expect specific hashtable "schemas". Another possible implementation is to do a ConvertTo-PSCustomObject that does more custom handling (and these aren't mutually exclusive). Additionally, a ConvertTo-Hashtable is probably useful.

We don't have this on our radar right now, but if someone wants to give a go at a ConvertFrom-Hashtable RFC and implementation, go for it.

We think the scenario we're trying to address is primarily casting nested hashtables of hashtables into PSCustomObjects (or possibly even other types).

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der zugehörigen Diskussion in Issue #109, insbesondere mit dem verlinkten Kommentar, um die vorgeschlagenen Konvertierungsszenarien und den ungeklärten Umfang zu verstehen. Bestimme, ob die Arbeit ConvertFrom-Hashtable, ConvertTo-PSCustomObject, ConvertTo-Hashtable oder mehrere Cmdlets abdecken sollte; für den Abschluss wäre ein fokussiertes RFC erforderlich, das für Feedback vom PowerShell Committee und eine Abstimmung bereit ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell
Bereich
cli
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.