PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

The `AdditionalMetadata` dictionary on the output objects is missing all but one property / entry compared to `Find-Module`

Open mklement0 opened this issue 1 year ago • 4 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

Find-Module populates the .AdditionalMetadata property of its output objects with a custom object containing properties such as summary, updated, Authors, ...

These are all missing from Find-PSResource's output objects, with the exception of NormalizedVersion (another difference is that the .AdditionalMetadata is now a generic dictionary rather than a custom object).

Possibly related:

  • #878
 (Find-PSResource CompletionPredictor).AdditionalMetadata

Expected behavior

This is what you get with Find-Module:

summary                   : Command-line intellisense based on PowerShell auto-completion
updated                   : 2023-12-22T17:09:11Z
Authors                   : PowerShell
ItemType                  : Module
developmentDependency     : False
isAbsoluteLatestVersion   : True
requireLicenseAcceptance  : False
PowerShellVersion         : 7.2
PackageManagementProvider : NuGet
lastUpdated               : 12/22/2023 5:09:11 PM -05:00
packageSize               : 39852
description               : Command-line intellisense based on PowerShell auto-completion
copyright                 : Copyright (c) Microsoft Corporation.
published                 : 5/3/2023 9:38:39 PM -04:00
versionDownloadCount      : 12546
FileList                  : CompletionPredictor.nuspec|CompletionPredictor.psd1|PowerShell.Predictor.dll|_manifest\spdx_2.2\manifest.spdx.json|_manifest\spdx_2.2\manifest.spdx.json.sha256
NormalizedVersion         : 0.1.1
downloadCount             : 15250
GUID                      : dab36133-7065-440d-ac9a-821187afc400
SourceName                : PSGallery
tags                      : PSEdition_Core PSModule
created                   : 5/3/2023 9:38:39 PM -04:00
CompanyName               : Microsoft Corporation
IsPrerelease              : false
isLatestVersion           : True

Actual behavior

Key               Value
---               -----
NormalizedVersion 0.1.1

Error details

No response

Environment data

v1.0.1

Visuals

No response

mklement0 avatar Dec 22 '23 17:12 mklement0

@mklement0 thanks for opening this issue. Our rationale for not including this metadata in AdditionalMetadata property was that these metadata properties are already present individually in PSResourceInfo and we didn't want to be redundant by including it again in AdditionalMetadata. Metadata property Summary is reflected as Description. Is there any scenario for which you want/need these properties in AdditionalMetadata?

anamnavi avatar Jan 08 '24 20:01 anamnavi

Thanks, @anamnavi.

I had assumed that the purpose of the property was the same.

Good to know that these are now direct properties, but that doesn't seem to be the case for all of them. For instance, PowerShellVersion (the minimum PowerShell version supported per the module manifest) is missing.

Is there a documented mapping between the old .AdditionalMetadata properties and the new, direct properties, including a design rationale for which properties weren't included?

On a related note (this information isn't in the old .AdditionalMetadata object either):

  • It would also be good to reflect the CompatiblePSEditions value from the module manifests, so that filtering by target edition becomes possible (while some modules have .Tag entries such as PSEdition_Core, these are merely a convention that many module authors do not - and shouldn't have to - observe).

mklement0 avatar Jan 08 '24 22:01 mklement0