Skip to content

fix(api): populate and document subject tag total count#1124

Merged
trim21 merged 1 commit into
bangumi:masterfrom
huoshen80:fix/subject-tag-total-count
Jul 19, 2026
Merged

fix(api): populate and document subject tag total count#1124
trim21 merged 1 commit into
bangumi:masterfrom
huoshen80:fix/subject-tag-total-count

Conversation

@huoshen80

Copy link
Copy Markdown
Contributor

背景

搜索接口已经正确填充条目标签的 total_cont,但 ToSubjectV0ToSlimSubjectV0 转换时遗漏了该字段,导致相关接口始终将其序列化为 0。同时,OpenAPI 的 Tag schema 也没有声明该字段。

total_cont 中的 cont 疑似 count 的历史拼写错误。由于它已经是 v0 API 对外暴露的字段名,本 PR 为保持兼容继续沿用 total_cont,不做破坏性重命名。

修改内容

  • ToSubjectV0 中填充标签的总使用次数
  • ToSlimSubjectV0 中填充标签的总使用次数
  • 在 OpenAPI Tag schema 中声明并说明 total_cont
  • 为两个转换函数添加回归测试

测试

  • go test -tags test ./web/res/...
  • yarn prettier --check openapi/components/subject_tags.yaml
  • yarn run test

@mergify

mergify Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@huoshen80 huoshen80 changed the title fix(api): 补充条目标签总使用次数及文档 fix(api): populate and document subject tag total count Jul 15, 2026
@trim21
trim21 merged commit 178296a into bangumi:master Jul 19, 2026
8 checks passed
@huoshen80

Copy link
Copy Markdown
Contributor Author

@trim21 看起来合并后的 vulnerability-scan 失败是因为项目当前使用 Go 1.26.4,
govulncheck 提示 GO-2026-5856,修复版本为 Go 1.26.5。
另外 .github/vulncheck-issue-template.md 的 title 包含未加引号的冒号,
导致自动创建 issue 时 YAML 解析失败。

我看文档那边目前还没自动构建,虽然之前文档没写出 total_cont 字段,但是请求会得到这个字段。

因为我软件打算使用这个字段过滤排除掉一些低质量 tag,所以想问一下这个错误拼写,你打算修正还是保留。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants