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

checker: pattern_added_or_changed has no body-level rules

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

这个 Issue 还没有评估数据。

描述

Surfaced while reviewing the walker migration in #949.

What's missing

check_request_property_pattern_added_or_changed.go and check_response_pattern_added_or_changed.go only emit property-level changes:

  • request-property-pattern-removed
  • request-property-pattern-added
  • request-property-pattern-changed
  • request-property-pattern-generalized

(and the response equivalents)

There are no body-level counterparts (request-body-pattern-* / response-body-pattern-*) — the constants don't exist, and the checker never inspects mediaTypeDiff.SchemaDiff.PatternDiff at the body level.

When this matters

OpenAPI lets the top-level request or response body be a string-typed schema with a pattern field, e.g.:

requestBody:
  content:
    text/plain:
      schema:
        type: string
        pattern: "^[a-z]+$"

If the pattern changes (^[a-z]+$ → ^[A-Z]+$), that's a breaking change for clients sending payloads matching the old pattern. Today's checker doesn't notice — oasdiff breaking returns clean for that change.

How common is it

Probably rare. Top-level string-typed bodies are unusual in REST APIs; the common case is the body schema has properties, which the property-level checker handles correctly. But the gap is real and an asymmetry vs every other body+property pair (anyOf / oneOf / allOf / nullable / type / min / max / dependent_schemas / prefix_items / etc all check both levels).

Fix shape

Mirrors the body-level pairs in the other recently-migrated checkers. Concretely:

  1. Add four constants in each file (RequestBodyPatternRemovedId etc).
  2. In the walker callback, emit at body level when info.schemaDiff.PatternDiff != nil, following the same four-case split (removed / added / changed / generalized) the property branch already does.
  3. Add localized messages in checker/localizations_src/ for all four locales (en, es, pt-br, ru).
  4. Tests using a top-level string body fixture.

Estimated: ~80 lines per side plus a couple of test fixtures. Probably half a day end-to-end with localisation.

Low priority — anyone who has top-level string-typed bodies in their spec, please add a 👍.

主要语言
Go
星标
1.4k
派生
109
平均合并
11 小时 5 分钟
30 天内合并 PR
32

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

oasdiff/oasdiff 的其他 Issue

查看 oasdiff/oasdiff 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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