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

flatten: allOf silently drops 3.1-specific schema keywords

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
60/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
go
领域
api

调研方向

Start in flatten/allof/merge_allof.go and read how the existing MinItems/MaxItems and type-conflict logic merges subschemas. Pick one of the easy items, such as Const or MinContains/MaxContains, and add its merge rule following that pattern. Check docs/ALLOF.md for the documented field list. Done means the keyword is merged or reports a conflict, with a test covering it.

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

描述

enhancement

Follow-up to #868 / #873.

flatten/allof/merge_allof.go doesn't reference any 3.1-specific schema keyword introduced by JSON Schema 2020-12. Every one of the 18 keywords below is silently dropped from the merged schema today — same class of bug as the numeric exclusiveMinimum / exclusiveMaximum issue that #873 just fixed.

Verified by grepping each field name against flatten/allof/merge_allof.go on main after #873 merge — zero references for all of them.

Easy — mirror existing patterns

Small, mechanical fixes. Land each in its own PR (or in one small batch).

  • Const — must be equal across subschemas; conflict if not (mirrors existing type-conflict logic). High priority — likely to appear in real specs.
  • MinContains / MaxContains — mirrors MinItems / MaxItems (most-restrictive wins).
  • ContentMediaType / ContentEncoding — string equality, conflict if mismatched.
  • DependentRequired — union of map[string][]string entries.
  • $defs (Defs in kin-openapi) — copy/merge by name.

Medium — schema-valued, need recursive merge

  • Contains / PropertyNames — single *SchemaRef; the conjunction is the merged schema of all subschemas' values.
  • PatternProperties / DependentSchemas — Schemas map; merge by key with recursive merge on value collisions.
  • PrefixItems — SchemaRefs slice; merge position-by-position.

Hard — semantics don't compose cleanly

For these, we should decide at the product level whether flatten errors out (safer) or silently approximates (today's behavior, but the result may be misleading).

  • If / Then / Else — conditional logic; the conjunction of two if/then/else schemas can't be expressed as a single if/then/else in general.
  • UnevaluatedItems / UnevaluatedProperties — semantics depend on which sibling keywords were considered "evaluating"; merging changes that context.

Out of scope

A few non-3.1 fields are also not merged today (XML, ExternalDocs, Example, Deprecated, AllowEmptyValue) and are documented as such in docs/ALLOF.md. Those are a separate decision.

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

环境准备

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

从这里开始

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

oasdiff/oasdiff 的其他 Issue

查看 oasdiff/oasdiff 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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