openapi-generators / openapi-generators/openapi-python-client

Using dictionary in query param

オープン
#1,064 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
2k
フォーク
293
平均マージ
34分
マージ済み PR(30日)
1

説明

Describe the bug
I have an endpoint that takes in a dictionary as a query param:

- name: metadata
          in: query
          required: false
          style: deepObject
          explode: true
          schema:
            type: object
            additionalProperties:
              type: string

note this:

          style: deepObject
          explode: true

The openapi generator generates same code whether I have

          style: deepObject
          explode: true

present or not. I am using version 0.19.1.

The URL generated is like:

http://localhost:8080/foo?author=Joshua%20Bloch&publisher=Pearson%20Addison-Wesley

When

          style: deepObject
          explode: true

is present, the URL should be like:

http://localhost:8080/foo?metadata[author]=Joshua%20Bloch&metadata[publisher]=Pearson%20Addison-Wesley

refer: https://swagger.io/docs/specification/serialization/

OpenAPI Spec File
see above

Desktop (please complete the following information):

  • OS: [e.g. macOS 10.15.1] macOS ventura (13)
  • Python Version: [e.g. 3.8.0]
  • openapi-python-client version [e.g. 0.1.0] 0.19.0

Additional context
Add any other context about the problem here.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

まず、openapi-python-client 0.19.0 を使用して、提供された style deepObject および explode true の OpenAPI クエリパラメーターを再現し、次に生成されたリクエストのクエリシリアライゼーションを追跡します。辞書キーによって URL に metadata[author] と metadata[publisher] が生成されることを確認して修正を検証し、この動作のリグレッションテストを追加または更新します。

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

評価

技術スタック
openapi, python
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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