🌟 [Major]: TOML 1.0.0 reading and writing now available in PowerShell#15
Open
Marius Storhaug (MariusStorhaug) wants to merge 9 commits into
Open
🌟 [Major]: TOML 1.0.0 reading and writing now available in PowerShell#15Marius Storhaug (MariusStorhaug) wants to merge 9 commits into
Marius Storhaug (MariusStorhaug) wants to merge 9 commits into
Conversation
- Add ConvertFrom-Toml, ConvertTo-Toml, Import-Toml, Export-Toml public commands - Add TomlDocument class with Data (OrderedDictionary) and FilePath properties - Add private helpers: ConvertFrom-TomlDateTime, ConvertFrom-TomlynTable, ConvertFrom-TomlynValue, ConvertTo-TomlynArray, ConvertTo-TomlynTable, ConvertTo-TomlynValue - Back with Tomlyn v2.0.0 (.NET TOML library) via src/assemblies/Tomlyn.dll - Enforce TOML 1.0.0 duplicate key and table redefinition rules via SyntaxParser.ParseStrict before deserializing - Map all 8 TOML types to PowerShell types (string, long, double, bool, DateTimeOffset, DateTime, TimeSpan, OrderedDictionary/object[]) - Add 116 Pester tests covering spec compliance, round-trips, file I/O, error handling, and all TOML 1.0.0 type categories - Add build.ps1 for local module assembly and test running - Add tests/bootstrap.ps1 for test module import - Add tests/data/ with 9 TOML fixture files - Update README.md with type mapping table, command reference, usage examples - Update examples/General.ps1 with comprehensive usage examples - Remove template placeholder files (LsonLib.dll, format/type XMLs, sample modules/scripts/variables) - Fix PSScriptAnalyzer warnings: UTF-8 BOM, indentation consistency PSScriptAnalyzer: 0 errors, 0 warnings Tests: 116/116 pass Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter MARKDOWNPOWERSHELL |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…dvanced fixtures - Replace Tomlyn (.NET) dependency with pure PowerShell parser/serializer - Add 19 private helper functions covering all TOML token types - Fix: sub-tables inside array-of-tables entries no longer falsely fail as redefinitions - Fix: space-separator datetimes (e.g. '1987-07-05 17:45:00Z') now parsed correctly - Add 5 advanced TOML fixture files covering deep AoT nesting, all numeric bases, all datetime forms, Unicode escapes, multi-line strings, and heterogeneous arrays - Remove src/assemblies/Tomlyn.dll and all Tomlyn* helpers - Set PowerShellVersion = 7.6 in manifest - 116 tests pass, PSScriptAnalyzer clean Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- src/functions/public/Toml/ -> src/functions/public/ - src/functions/private/Toml/ -> src/functions/private/ - Remove template placeholder sections from README.md Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter MARKDOWNPOWERSHELL |
Remove header.ps1, finally.ps1, init/initializer.ps1, manifest.psd1, and src/README.md — none are needed by the pure-PowerShell module. Build and 116 tests remain green. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter MARKDOWNPOWERSHELL |
- One file with Describe/Context hierarchy per command - Remove bootstrap.ps1 — module is pre-imported by the test runner - Add advanced fixture tests covering AoT sub-tables, space-separator datetimes, deep nesting, and all numeric forms - 120 tests, 0 failures Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter MARKDOWNPOWERSHELL |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter MARKDOWNPOWERSHELL |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter MARKDOWNPOWERSHELL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Toml module now provides complete TOML 1.0.0 read and write support in pure PowerShell 7.6+. Scripts and tools can parse TOML configuration files into typed PowerShell objects, modify them in memory, and write them back — with no external dependencies required.
New: Parse TOML text into PowerShell objects
ConvertFrom-Tomlparses any valid TOML 1.0.0 document into aTomlDocument. TheDataproperty is an ordered dictionary that preserves source key order. All TOML scalar types map to native PowerShell types.[string][long][double][bool][System.DateTimeOffset][System.DateTime][System.TimeSpan][object[]][System.Collections.Specialized.OrderedDictionary]New: Serialize PowerShell objects to TOML text
ConvertTo-Tomlconverts ordered dictionaries and hashtables into valid TOML text. Nested tables emit[header]sections and arrays of tables emit[[header]]sections in the correct order.New: Import and export TOML files directly
Import-Tomlreads a.tomlfile from disk and returns aTomlDocumentwith the resolved file path attached.Export-Tomlwrites any object orTomlDocumentto disk as UTF-8 without BOM.Technical Details
StringBuilderfor output assembly,OrderedDictionaryfor key ordering,ArrayListfor array-of-tables growth.tests/data/advanced/cover deep nesting, all integer/float/datetime forms, Unicode escapes, multi-line strings, and heterogeneous arrays.Related issues