platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Protect certain frontmatter metadata fields

Open sdwheeler opened this issue 1 year ago • 2 comments

Summary of the new feature / enhancement

There are 2 metadata fields that should not be allowed to be overwritten by values passed to cmdlet using the Metadata parameters:

  • PlatyPS schema version
  • document type

Proposed technical implementation details (optional)

  • The value of those fields should reflect what the output methods are creating
  • If the user includes those fields in the hashtable passed to the Metadata parameter, the values ignored and a warning written to tell the user.

sdwheeler avatar Jul 09 '24 21:07 sdwheeler

In https://github.com/PowerShell/platyPS/commit/27d5ffe4090f146b64c7d91453d6683c68c8ee53

Tests

  • Export-MarkdownModuleFile - fixed and writes warnings about trying overwrite keys
  • Export-YamlModuleFile - FAIL - keys overwritten
  • Export-MarkdownCommandHelp - keys are not overwritten, but no warning messages about attempt to overwrite
  • Export-YamlCommandHelp - keys are not overwritten, but no warning messages about attempt to overwrite

sdwheeler avatar Aug 23 '24 15:08 sdwheeler

OPS10 test results

Fixed

  • Export-MarkdownModuleFile - fixed and writes warnings about trying overwrite keys
  • Export-YamlModuleFile - fixed and writes warnings about trying overwrite keys

Need warnings

  • Export-MarkdownCommandHelp - keys are not overwritten, but no warning messages about attempt to overwrite
  • Export-YamlCommandHelp - keys are not overwritten, but no warning messages about attempt to overwrite

sdwheeler avatar Sep 17 '24 21:09 sdwheeler

Fixed in latest build.

sdwheeler avatar Mar 10 '25 18:03 sdwheeler