Transitive Dependencies and namedValues issues
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- azure, typescript
調査の方向性
Start by reproducing apiops extract with a named value whose displayName differs from its name, then inspect the Transitive Dependency Resolver's lookup and Management API request. Compare the behavior with --no-transitive and manual dependencies. Done means extraction resolves the displayName to the Management API name and succeeds for the described named-value case.
索引モデルが issue の本文から書いたものです。
説明
Command that triggered the bug
apiops extract
Expected behavior
Hello,
The ApiOps-CLI Transitive Dependencies resolver seems to have issues with extracting namedValues when the "name" property of the namedValue is different than the "displayName" property of the namedValue.
According to Microsoft's documentation, referencing a namedValue in a policyFragment is done using it's displayName property the following way {{display_name}} (ref: https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-properties?tabs=azure-portal#use-a-named-value). This is how we have also configured the policyFragments on our APIM Instance.
However, the APIM Management API will fetch details about a named value using the name property instead of displayName (ref: https://learn.microsoft.com/en-us/rest/api/apimanagement/named-value/get?view=rest-apimanagement-2024-05-01&tabs=HTTP):
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testarmTemplateproperties2",
"type": "Microsoft.ApiManagement/service/namedValues",
"name": "testarmTemplateproperties2",
"properties": {
"displayName": "propName",
"value": "propValue",
"tags": [
"foo",
"bar"
],
"secret": false
}
}
What happens when we use the Transitive Dependency Resolver seems to be that when the API definition is parsed, the Resolver notices the "displayName" property of the namedValue inside one of the API's policyFragments. It then calls the Managemend API using the "displayName" property of the namedValue which obviously fails the API Call, as the Management API Call is not correct, therefore the extraction fails.
While I can understand that maybe having different values for the "displayName" and "name" properties of a namedValue is atypical, as far as I understand both properties are unique on APIM level (otherwise, you wouldn't be able to fetch a single value using "name" with the ManagementAPI, and the policyFragment would be confused by duplicated "displayName" properties) and it's also not a scenario that Microsoft prevents in any way or even recommends against.
My curiosity is if this bug is known to happen when "displayName" and "name" properties of a namedValue are different and if a mechanism that would pre-validate namedValues with the Transitive Dependency Resolver could be implemented. If it could build an map of key : value pairs formed from the "displayName" : "name" properties of namedValues in memory, then a check could be done for the "displayName" of a namedValue of an API's policyFragment in order to find it's "name" and then do the correct Management API call to fetch this namedValue.
For reference the namedValue we had issues with is KV referenced, not sure if there is any difference in processing ApiOps does for KV references compared to plain text or secrets namedValues.
Running ApiOps with the --no-transitive flag and manually specifying dependencies works fine.
Actual behavior
ApiOps extraction fails due to broken API Call.
apiops CLI version
1.0.2
Environment details
Private APIM instance, extraction and publish running from CI/CD.
CI/CD environment
Yes, GitLab CI/CD
Is this bug blocking you?
Not necessary, but makes maintaining the extraction parameters file more difficult when such a cool feature like the Transitive Dependency Resolver exists.
- 主要言語
- TypeScript
- スター
- 29
- フォーク
- 10
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 22
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/apiops-cli のほかの issue
-
type:question
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Azure/apiops-cli#277 ·
-
type:documentation
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
Azure/apiops-cli#250 ·
-
Documentation P2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/apiops-cli#24 · コメント 1 件 ·
-
type:bug
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
Azure/apiops-cli#276 ·
-
type:feature
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
Azure/apiops-cli#275 · コメント 2 件 · リアクション 2 件 ·
Azure/apiops-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
copse-dev/agent-pane#2953 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·