API - Get with `$select=Tags` does not return tags for some packages where `<d:Tags xml:space="preserve">`

Aperta
#298 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
powershell, xml
Ambito
api

Direzione di ricerca

Start by tracing the API v2 Packages query handling for $select=Tags and how the Tags property is serialized, using the Trackyon.Utils and Az.Accounts responses in the issue as the comparison. Reproduce the query with both packages and inspect the relevant tests or add a regression case for tags containing xml:space="preserve". Done means $select=Tags returns the tag value for both packages.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.
Steps to reproduce

Example package is Trackyon.Utils.

If you do a get with no $select, tags are returned.

Request URL: https://www.powershellgallery.com/api/v2/Packages()?$filter=Id+eq+%27Trackyon.Utils%27+and+IsLatestVersion+and+not+IsPrerelease

Results
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://www.powershellgallery.com/api/v2" xmlns="http://www.w3.org/2005/Atom"
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss"
  xmlns:gml="http://www.opengis.net/gml">
  <id>http://schemas.datacontract.org/2004/07/</id>
  <title />
  <updated>2025-01-13T08:34:49Z</updated>
  <link rel="self" href="https://www.powershellgallery.com/api/v2/Packages" />
  <entry>
    <id>https://www.powershellgallery.com/api/v2/Packages(Id='Trackyon.Utils',Version='0.2.1')</id>
    <category term="NuGetGallery.OData.V2FeedPackage"
      scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" href="https://www.powershellgallery.com/api/v2/Packages(Id='Trackyon.Utils',Version='0.2.1')" />
    <link rel="self" href="https://www.powershellgallery.com/api/v2/Packages(Id='Trackyon.Utils',Version='0.2.1')" />
    <title type="text">Trackyon.Utils</title>
    <updated>2025-01-13T08:30:01Z</updated>
    <author>
      <name>@DonovanBrown</name>
    </author>
    <content type="application/zip" src="https://www.powershellgallery.com/api/v2/package/Trackyon.Utils/0.2.1" />
    <m:properties>
      <d:Id>Trackyon.Utils</d:Id>
      <d:Version>0.2.1</d:Version>
      <d:NormalizedVersion>0.2.1</d:NormalizedVersion>
      <d:Authors>@DonovanBrown</d:Authors>
      <d:Copyright>(c) @DonovanBrown. All rights reserved.</d:Copyright>
      <d:Created m:type="Edm.DateTime">2021-08-08T21:21:13.13</d:Created>
      <d:Dependencies></d:Dependencies>
      <d:Description>Useful functions for use from PowerShell</d:Description>
      <d:DownloadCount m:type="Edm.Int32">2192180</d:DownloadCount>
      <d:GalleryDetailsUrl>https://www.powershellgallery.com/packages/Trackyon.Utils/0.2.1</d:GalleryDetailsUrl>
      <d:IconUrl m:null="true" />
      <d:IsLatestVersion m:type="Edm.Boolean">true</d:IsLatestVersion>
      <d:IsAbsoluteLatestVersion m:type="Edm.Boolean">true</d:IsAbsoluteLatestVersion>
      <d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease>
      <d:Language m:null="true" />
      <d:LastUpdated m:type="Edm.DateTime">2025-01-13T08:30:01.647</d:LastUpdated>
      <d:Published m:type="Edm.DateTime">2021-08-08T21:21:13.13</d:Published>
      <d:PackageHash>kClO29g0o/z8bKGnjo9D2nLDcjrF8K34408Zb5ZPS3Kfrf9kCCz/dKKHcCcu3Q0QmKTk3V0eRw6TTgLBMvesZA==
      </d:PackageHash>
      <d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm>
      <d:PackageSize m:type="Edm.Int64">10890</d:PackageSize>
      <d:ProjectUrl>http://DonovanBrown.com</d:ProjectUrl>
      <d:ReportAbuseUrl>https://www.powershellgallery.com/packages/Trackyon.Utils/0.2.1/ReportAbuse</d:ReportAbuseUrl>
      <d:ReleaseNotes m:null="true" />
      <d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance>
      <d:Summary m:null="true" />
      <d:Tags xml:space="preserve"> PSFunction_Backup-Location PSCommand_Backup-Location PSFunction_Get-OperatingSystem
        PSCommand_Get-OperatingSystem PSFunction_New-Directory PSCommand_New-Directory PSFunction_Set-As
        PSCommand_Set-As PSFunction_Show-Browser PSCommand_Show-Browser PSFunction_Add-Item PSCommand_Add-Item
        PSFunction_Enter-Location PSCommand_Enter-Location PSFunction_base64 PSCommand_base64 PSIncludes_Function
      </d:Tags>
      <d:Title m:null="true" />
      <d:VersionDownloadCount m:type="Edm.Int32">1451041</d:VersionDownloadCount>
      <d:MinClientVersion m:null="true" />
      <d:LastEdited m:null="true" />
      <d:LicenseUrl m:null="true" />
      <d:LicenseNames m:null="true" />
      <d:LicenseReportUrl m:null="true" />
      <d:ItemType>Module</d:ItemType>
      <d:FileList>
        Trackyon.Utils.nuspec|README.md|Trackyon.Utils.psd1|Trackyon.Utils.psm1|en-US\about_Trackyon.Utils.help.txt|en-US\Trackyon.Utils-help.xml|Internal\Utils.ps1|Public\Add-Item.ps1|Public\Backup-Location.ps1|Public\base64.ps1|Public\Enter-Location.ps1|Public\Get-OperatingSystem.ps1|Public\New-Directory.ps1|Public\Set-As.ps1|Public\Show-Browser.ps1
      </d:FileList>
      <d:GUID>384ca328-1154-4b2e-9cde-5e8e3b874749</d:GUID>
      <d:PowerShellVersion m:null="true" />
      <d:PowerShellHostVersion m:null="true" />
      <d:DotNetFrameworkVersion m:null="true" />
      <d:CLRVersion m:null="true" />
      <d:ProcessorArchitecture m:null="true" />
      <d:CompanyName>Trackyon LLC</d:CompanyName>
      <d:Owners>darquewarrior</d:Owners>
    </m:properties>
  </entry>
</feed>

But if you add $select=Tags, tags are not included.

Request URL: https://www.powershellgallery.com/api/v2/Packages()?$filter=Id+eq+%27Trackyon.Utils%27+and+IsLatestVersion+and+not+IsPrerelease&$select=Authors,Published,RequireLicenseAcceptance,Tags,Version

Results
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://www.powershellgallery.com/api/v2" xmlns="http://www.w3.org/2005/Atom"
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss"
  xmlns:gml="http://www.opengis.net/gml">
  <id>http://schemas.datacontract.org/2004/07/</id>
  <title />
  <updated>2025-01-13T08:24:25Z</updated>
  <link rel="self" href="https://www.powershellgallery.com/api/v2/Packages" />
  <entry>
    <id>https://www.powershellgallery.com/api/v2/Packages(Id='Trackyon.Utils',Version='0.2.1')</id>
    <category term="NuGetGallery.OData.V2FeedPackage"
      scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" href="https://www.powershellgallery.com/api/v2/Packages(Id='Trackyon.Utils',Version='0.2.1')" />
    <link rel="self" href="https://www.powershellgallery.com/api/v2/Packages(Id='Trackyon.Utils',Version='0.2.1')" />
    <title type="text">Trackyon.Utils</title>
    <updated>2025-01-13T08:24:25Z</updated>
    <author>
      <name>@DonovanBrown</name>
    </author>
    <content type="application/zip" src="https://www.powershellgallery.com/api/v2/package/Trackyon.Utils/0.2.1" />
    <m:properties>
      <d:Authors>@DonovanBrown</d:Authors>
      <d:Published m:type="Edm.DateTime">2021-08-08T21:21:13.13</d:Published>
      <d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance>
      <d:Tags></d:Tags>
      <d:Version>0.2.1</d:Version>
    </m:properties>
  </entry>
</feed>

One difference I've noticed with Trackyon.Utils vs. other modules, say Az.Accounts: When tags are returned, the XML section starts with <d:Tags xml:space="preserve">.

Expected behavior

All packages with tags on PowerShell Gallery should include the value of the tags when $select=Tags

Same query, but with Az.Accounts. Request URL: https://www.powershellgallery.com/api/v2/Packages()?$filter=Id+eq+%27Az.Accounts%27+and+IsLatestVersion+and+not+IsPrerelease&$select=Authors,Published,RequireLicenseAcceptance,Tags,Version.

Results
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://www.powershellgallery.com/api/v2" xmlns="http://www.w3.org/2005/Atom"
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss"
  xmlns:gml="http://www.opengis.net/gml">
  <id>http://schemas.datacontract.org/2004/07/</id>
  <title />
  <updated>2025-01-13T09:27:33Z</updated>
  <link rel="self" href="https://www.powershellgallery.com/api/v2/Packages" />
  <entry>
    <id>https://www.powershellgallery.com/api/v2/Packages(Id='Az.Accounts',Version='4.0.0')</id>
    <category term="NuGetGallery.OData.V2FeedPackage"
      scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" href="https://www.powershellgallery.com/api/v2/Packages(Id='Az.Accounts',Version='4.0.0')" />
    <link rel="self" href="https://www.powershellgallery.com/api/v2/Packages(Id='Az.Accounts',Version='4.0.0')" />
    <title type="text">Az.Accounts</title>
    <updated>2025-01-13T09:27:33Z</updated>
    <author>
      <name>Microsoft Corporation</name>
    </author>
    <content type="application/zip" src="https://www.powershellgallery.com/api/v2/package/Az.Accounts/4.0.0" />
    <m:properties>
      <d:Authors>Microsoft Corporation</d:Authors>
      <d:Published m:type="Edm.DateTime">2024-11-19T05:04:35.383</d:Published>
      <d:RequireLicenseAcceptance m:type="Edm.Boolean">true</d:RequireLicenseAcceptance>
      <d:Tags>Azure ResourceManager ARM Accounts Authentication Environment Subscription PSModule PSEdition_Core
        PSEdition_Desktop</d:Tags>
      <d:Version>4.0.0</d:Version>
    </m:properties>
  </entry>
</feed>
Actual behavior

Some packages with tags on PowerShell Gallery does not include the value of the tags when $select=Tags

Error details

No response

Environment data

Not relevant

Version

Not relevant

Visuals

No response

Lingua principale
PowerShell
Stelle
289
Fork
83
Merge medio
1m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PowerShell/PowerShellGallery

Tutte le issue di PowerShell/PowerShellGallery

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.