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

未關閉
#298 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
半天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
powershell, xml
領域
api

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
PowerShell
星號
289
分支
83
平均合併
1 分鐘
30 天內合併 PR
1

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

PowerShell/PowerShellGallery 的其他 Issue

查看 PowerShell/PowerShellGallery 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。