[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時間
- マージ済み PR(30日)
- 155
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenAPITools/openapi-generator のほかの issue
-
[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339対応中かも @teovillanueva が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OpenAPITools/openapi-generator#25297 ·
メンテナーはふだん 1 日以内に返信
-
難易度 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 が 7 日前に担当しました。 オープン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 が 7 日前に担当しました。 オープン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 が 7 日前に担当しました。 オープンIssue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenAPITools/openapi-generator#25223 ·
メンテナーはふだん 1 日以内に返信
OpenAPITools/openapi-generator の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QuiltMC/update-quilt-meta#28 ·
-
awaiting triage Documentation P3
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
area/build area/maintainability component/camunda-process-test kind/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToList対応中かも @mohamed-elbrik が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area/kotlin
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信