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

Runtime expression `name` rule inconsistent with path template grammar

未关闭
#5,285 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
冷清
技术栈
markdown

调研方向

结合 OpenAPI 3.2 的路径模板语法,阅读 runtime expression 中针对 name 和 token 的 ABNF 规则。在决定 name 是否应要求一个字符之前,先确定空查询名称是否是有意设计的;完成的标准是语法和规范周边的文字对该决定进行了统一的说明。

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

描述

The runtime expression ABNF grammar defines:

name = *( char )
token = 1*tchar

The * (zero or more) quantifier on name means expressions like $request.query. and $request.path. with empty names are syntactically valid per the grammar.

The OpenAPI spec states that the Parameter Object's name field is REQUIRED:

REQUIRED. The name of the parameter. Parameter names are case-sensitive.

A required field with an empty string value is arguably not meaningful, though the spec doesn't explicitly say "non-empty".

For path parameters specifically, this is inconsistent with the path template grammar introduced in OpenAPI 3.2.0:

template-expression-param-name = 1*( %x00-7A / %x7C / %x7E-10FFFF )

The 1* quantifier requires at least one character for path parameter names. So {userId} is valid but {} is not. Yet the runtime expression $request.path. (empty name) is accepted by the grammar.

For query parameters, the situation is less clear — HTTP technically allows empty query parameter keys (?=value), though this is extremely uncommon.

For consistency with the path template grammar and the token = 1*tchar rule (which already requires at least one character for headers), consider changing:

name = *( char )

to:

name = 1*( char )

This would require at least one character for query and path parameter names, aligning the runtime expression grammar with the path template grammar.

主要语言
Markdown
星标
31.2k
派生
9.2k
平均合并
2 天 9 小时
30 天内合并 PR
17

环境准备

从这里开始

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

OAI/OpenAPI-Specification 的其他 Issue

查看 OAI/OpenAPI-Specification 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

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