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

format: email rejects RFC 5321 Mailbox values when the TLD is not recognized

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

还没有人认领这个 Issue。

评估

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

调研方向

从 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.xml depends on com.networknt:json-schema-validator.

  • NetworkNT’s com.networknt.schema.format.EmailFormat constructs:

    new IPv6AwareEmailValidator(true, true)
    
  • IPv6AwareEmailValidator extends Apache Commons Validator’s EmailValidator.

  • Apache Commons EmailValidator.isValidDomain(...) delegates to DomainValidator.

  • DomainValidator.isValid(...) checks that the domain has a recognized top-level domain via isValidTld(...).

  • DomainValidator documents 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 模板
  • 阅读贡献指南

从这里开始

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

atlassian/openapi-request-validator 的其他 Issue

查看 atlassian/openapi-request-validator 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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