Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG][RUST] Reqwest - encoding of spaces in path parameters

オープン 初心者向け
#25,257 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@GlenWright がすでに取り組んでいます。

2026年10月14日 から。

  • #25258 @GlenWright による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
api

調査の方向性

バグは api_mod.mustache 内のヘルパー関数 urlencode にあります。このヘルパーは、Rust テンプレートの reqwest と reqwest-trait がパスパラメータに使用しています。issue の仕様からクライアントを生成し、スペースが + として出力されることを確認してから、そのヘルパー関数を読んでください。パスパラメータ内のスペースが %20 にエンコードされ、リテラルの + が引き続き %2B にエンコードされ、reqwest と reqwest-trait の両方の出力が変わったら完了です。

索引モデルが issue の本文から書いたものです。

説明

Issue: Bug
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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenAPITools/openapi-generator のほかの issue

OpenAPITools/openapi-generator の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。