format: email rejects RFC 5321 Mailbox values when the TLD is not recognized
还没有人认领这个 Issue。
评估
调研方向
从 openapi-request-validator-core/pom.xml 开始,跟踪该格式的处理路径:电子邮件路径依次经过 NetworkNT 的 EmailFormat、IPv6AwareEmailValidator、Apache Commons EmailValidator 和 DomainValidator。验证当前对语法有效但 TLD 未被识别的域名的行为,然后定义覆盖范围,以表明无需 IANA TLD 要求即可接受 RFC 5321 Mailbox 语法。
由索引模型根据 Issue 内容生成。
描述
Summary
format: email validation currently appears to reject email addresses whose domain has a syntactically valid top-level label but is not in the validator's recognized/IANA TLD list.
That seems stricter than the OpenAPI email format definition, which says that email is an email address as defined by the RFC 5321 Mailbox rule.
Example
Schema:
type: object
properties:
email:
type: string
format: email
required:
- email
Request body:
{
"email": "[email protected]"
}
Actual result: validation fails.
Expected result: this should pass format: email syntax validation, because the domain part is syntactically valid under RFC 5321:
Mailbox = Local-part "@" ( Domain / address-literal )
Domain = sub-domain *("." sub-domain)
RFC 5321 does not require the final label to be present in the IANA root zone or in an implementation-maintained TLD list for the address to match the Mailbox grammar.
Relevant code path
This seems to come from the Java validation stack rather than from OpenAPI itself:
-
openapi-request-validator-core/pom.xmldepends oncom.networknt:json-schema-validator. -
NetworkNT’s
com.networknt.schema.format.EmailFormatconstructs:new IPv6AwareEmailValidator(true, true) -
IPv6AwareEmailValidatorextends Apache Commons Validator’sEmailValidator. -
Apache Commons
EmailValidator.isValidDomain(...)delegates toDomainValidator. -
DomainValidator.isValid(...)checks that the domain has a recognized top-level domain viaisValidTld(...). -
DomainValidatordocuments this as validation of TLDs “as defined and maintained by the Internet Assigned Numbers Authority (IANA).”
Why this matters
This makes format: email unsuitable for some valid API inputs, including internal/test/private domains (with local DNS resolution).
Suggested fix
Please consider to configure the underlying email validator so format: email checks RFC 5321 Mailbox syntax without requiring a recognized/IANA TLD.
Thanks!
- 主要语言
- Java
- 星标
- 17
- 派生
- 6
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
atlassian/openapi-request-validator 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 3/5 1-2 天 新手友好度 64/100
-
难度 3/5 半天 新手友好度 55/100
-
难度 3/5 1-2 天 新手友好度 62/100
-
Message context not populated when validating response headers可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
查看 atlassian/openapi-request-validator 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
strimzi/strimzi-kafka-operator#13328 · 1 条评论 · 3 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
OpenLiberty/ci.maven#2137 ·
维护者通常 1 天内回复
-
Payer adjustment can exceed the balance left after copay and deductible, so claim payments add up to more than the charge可能已有人在做 @DG47 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 79/100
synthetichealth/synthea#1772 ·
维护者通常 13 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
geonetwork/core-geonetwork#9592 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
NationalSecurityAgency/ghidra#10040 ·
维护者通常 2 天内回复