[BUG][RUST] Reqwest - encoding of spaces in path parameters
维护者通常 1 天内回复
评估
调研方向
问题出在 api_mod.mustache 中的辅助函数 urlencode 里,Rust 模板 reqwest 和 reqwest-trait 都用它来处理路径参数。请根据 issue 中的规范生成一个客户端,并检查空格是否被输出为 +,然后阅读这个辅助函数。完成的标准是:路径参数中的空格被编码为 %20,字面量 + 仍被编码为 %2B,并且 reqwest 和 reqwest-trait 的输出都发生了变化。
由索引模型根据 Issue 内容生成。
描述
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using reqwest, path parameters with spaces are incorrectly encoded with a + instead of %20. For example, Glen Wright becomes Glen+Wright, when it should be Glen%20Wright.
openapi-generator version
Reproduced with latest at time of writing: 1fdc3307942fcf853990cda8701d71c7e0753157.
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Reqwest - path parameter space encoding
version: "1.0.0"
paths:
/api/{spacedParam}:
parameters:
- in: path
name: spacedParam
schema:
type: string
required: true
description: A path parameter with a space.
get:
operationId: getValue
responses:
'200':
description: A returned value.
content:
application/json:
schema:
$ref: '#/components/schemas/returnedValue'
example:
spacedParam: A path parameter with a + instead of a space.
components:
schemas:
returnedValue:
type: object
required:
- spacedParam
properties:
spacedParam:
type: string
Generation Details
Generate client with -i spec.yaml -g rust -o output.
Steps to reproduce
- Generate client as above.
- Call
api.get_value(&config, "Spaced Param"); - Observe that the path parameter is encoded as
Spaced+Param.
Related issues/PRs
#11242. is the same issue, but for Java.
Suggest a fix
Update the urlencode function in api_mod.mustache for reqwest and reqwest-trait to replace + with %20. This will not impact actual instances of + as they are encoded properly as %2B.
- 主要语言
- Java
- 星标
- 26.8k
- 派生
- 7.7k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 144
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenAPITools/openapi-generator 的其他 Issue
-
[BUG] ExampleGenerator returns the string "{}" (or null) for `type: object` schemas without `properties`可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
OpenAPITools/openapi-generator#25237 ·
维护者通常 1 天内回复
-
[BUG] OpenApiEvaluator reports "default value not in enum" for numerically equal values with different scale (e.g. 1.5 and 1.50)可能已有人在做 @mohitduhan19 于 4 天前认领。 未关闭Issue: Bug
难度 2/5 1-3 小时 新手友好度 78/100
OpenAPITools/openapi-generator#25233 ·
维护者通常 1 天内回复
-
[BUG] OpenApiEvaluator emits "Unused model" warnings even when recommendations are disabled可能已有人在做 @mohitduhan19 于 4 天前认领。 未关闭Issue: Bug
难度 2/5 1-3 小时 新手友好度 82/100
OpenAPITools/openapi-generator#25232 ·
维护者通常 1 天内回复
-
[BUG][KOTLIN] multiplatform/jvm-ktor: `DELETE` without `requestBody` sends `"Content-Type: application/json"` with an empty body可能已有人在做 @mohitduhan19 于 4 天前认领。 未关闭Issue: Bug
难度 2/5 1-3 小时 新手友好度 78/100
OpenAPITools/openapi-generator#25223 ·
维护者通常 1 天内回复
-
Issue: Bug
难度 2/5 1-3 小时 新手友好度 65/100
OpenAPITools/openapi-generator#25218 ·
维护者通常 1 天内回复
查看 OpenAPITools/openapi-generator 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
OpenIntegrationEngine/engine#496 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 76/100
SasanLabs/VulnerableApp#836 ·
维护者通常 1 天内回复
-
enhancement frontend
难度 2/5 1-3 小时 新手友好度 83/100
Albertinesilva/backend-engineering-journey-java-springboot#46 ·
-
Snyk: vulnerabilities in jackson-databind 2.21.5可能已有人在做 @harrywu23 今天认领。 未关闭bug
难度 1/5 1-3 小时 新手友好度 80/100
SOFTENG-310-Group-4/Project-A1-310-Group-4#115 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
carlos-emr/carlos#4833 · 1 条评论 ·
维护者通常 1 天内回复