Array of entities in request body
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in lib/grape-swagger/doc_methods/move_params.rb at MoveParams#build_definition, then read the related issue and the request-body examples. Compare the generated specification with Grape's requirement for an object containing the array under a top-level key. Done means the specification represents the intended JSON object without requiring a dummy optional parameter.
索引モデルが issue の本文から書いたものです。
説明
Related issue: https://github.com/ruby-grape/grape-entity/issues/252
As for example above, we want request body to be:
{
"accounts": [
{
"cma": 0,
"name": "string",
"environment": "string",
"sites": 0,
"username": "string",
"password": "string"
}
]
}
But actually:
[
{
"cma": 0,
"name": "string",
"environment": "string",
"sites": 0,
"username": "string",
"password": "string"
}
]
Grape also wants the array to be in the key of top level JSON object.
( Top level array data cannot be handled by Grape out of the box ( cf. https://github.com/ruby-grape/grape/issues/1730 ). )
So it seems the generated specification is broken.
A workaround is to adding dummy optional parameter.
It forces the request body to be a JSON object.
I've found that making MoveParams#build_definition to always use object_type fixes the issue.
Is this reasonable fix?
- 主要言語
- Ruby
- スター
- 1.1k
- フォーク
- 477
- 平均マージ
- 5時間 25分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ruby-grape/grape-swagger のほかの issue
-
Support default_response and default in 2.3; stop reading route.desc対応中かも @numbata が 56 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ruby-grape/grape-swagger#989 ·
メンテナーはふだん 1 日以内に返信
-
Length limits (minLength/maxLength, minItems/maxItems) are dropped from body params moved into a definition対応中かも @numbata が 7 日前に担当しました。 オープン
ruby-grape/grape-swagger#1010 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
ruby-grape/grape-swagger#987 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug report: omitted array parameters with `array_use_braces: true`対応中かも @olivier-thatch が 530 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
ruby-grape/grape-swagger#952 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
ruby-grape/grape-swagger#950 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
ruby-grape/grape-swagger の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
yegor256/intercepted#128 ·
-
documentation good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
ysb3996-blip/oops#51 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Remove leftover Cloud66 custom_web process from Procfile対応中かも @ShahadatTest が今日担当しました。 オープンDifficulty: Easy Good First Issue
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
rubyforgood/casa#7330 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信