Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] API's with revisions are not being set to current.

未关闭
#646 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
azure, csharp
领域
api, cloud

调研方向

从 tools/code/publisher/Api.cs 第 369 行附近开始,跟踪 CorrectApimRevisionNumber,将其修订版本检查与 API 的 apiInformation.json 中的 isCurrent 值进行比较。重现所述的 Azure APIM 提取和发布流程,然后验证工件中标记为当前的修订版本在部署后仍然是当前版本。

由索引模型根据 Issue 内容生成。

描述

Release version

6.0.1.1

Describe the bug

The publishing of our APIM artifacts is failing once there's a reference to an API operation that only exists in the parent APIs second revision, even though the second revision should be the current revision. Looking at the APIs in Azure, I see that the first revision is set as current even though the APIs apiInformation.json file has it's isCurrent property set to true.

From what I can tell, looking at the code, the isCurrent value is being nulled out of the API Dto object to prevent occasional failures.

image

This causes the API to be initially deployed with out the isCurrent property set, defaulting to revision 1 as current.

I then noticed that there's a process in place to "correct" the revision number: CorrectApimRevisionNumber.
But, reviewing that code, I think I found a small bug preventing that process from correcting the revision numbers of revisioned APIs.

image

I could be wrong, but it appears that this would skip all revisioned APIs when assessing them for correction.

To test this, I cloned the repo and updated line 369 to:

if (ApiName.IsNotRevisioned(name))

After that, I ran it locally and it published successfully.

Expected behavior

I expect API revisions to be set correctly in accordance to the API's apiInformation.json file.

Actual behavior

Revisioned APIs do not have the correct revision set to current after deployment, causing failures when anything in the now non-current API is referenced.

Reproduction Steps

In a new APIM instance:

  1. Create an API with a single operation.
  2. Revision the API.
  3. Create another operation in that new revision.
  4. Set the second revision as current (Make current).
  5. Extract the APIM instance.
  6. Delete all APIs or create another new APIM instance.
  7. Publish the extracted artifacts to the cleaned or new APIM instance.

You should see that revision 1 is incorrectly set as current.

主要语言
C#
星标
448
派生
247
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/apiops 的其他 Issue

查看 Azure/apiops 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。