loopbackio / loopbackio/loopback-next

Define a required parameter using a sugar API

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

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

developer-experience feature good first issue Hacktoberfest REST
主要言語
TypeScript
スター
5.1k
フォーク
1.1k
平均マージ
2日 21時間
マージ済み PR(30日)
27

説明

At the moment, it is not possible to use `@param` shortcuts like `@param.query.string` to define a required parameter.

One has to use `@param` directly (but don't have to specify the type since LB4 can infer the type from TypeScript metadata). For example:

```ts
@param({name: 'format', in: 'query', required: true}) format?: string
```

Ideally, I would like LB4 to provide the following syntax for annotating parameters as required:

```ts
@param.query.string('format', {required: true}) format?: string
```

## Acceptance criteria

- [ ] Modify all `@param.SOURCE.TYPE()` shortcuts (and possibly other similar shortucts) to accept a new optional argument of type `Partial` and use the provided properties to enhance (or amend) the spec generated by the decorator.
- [ ] Modify `@param.array()` in a similar way, the new optional argument will be the fourth arg.
- [ ] Modify `@param.query.object()` similarly, the new optional argument will be the third arg.
- [ ] Verify that the API documentation is able to pick up the changes

---

## 🎆 Hacktoberfest 2020

Greetings :wave: to all Hacktoberfest 2020 participants!

Here are few tips 👀 to make your start easier, see also #6456:

- Before you start working on this issue, please leave a comment to let others know.
- If you are new to GitHub pull requests, then you can learn about the process in [Submitting a pull request to LoopBack 4](https://loopback.io/doc/en/lb4/submitting_a_pr.html).
- If this is your first contribution to LoopBack, then please take a look at our [Developer guide](https://loopback.io/doc/en/lb4/code-contrib-lb4.html)
- Feel free to ask for help in `#loopback-contributors` channel, you can join our Slack workspace [here](https://join.slack.com/t/loopbackio/shared_invite/zt-8lbow73r-SKAKz61Vdao~_rGf91pcsw).

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

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

はじめの一歩

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

調査の方向性

まず、@param.SOURCE.TYPE()、@param.array()、@param.query.object() ショートカットの TypeScript 実装を見つけ、生成された ParameterObject 仕様が API ドキュメントにどのように公開されているかを調べます。指定されたオプションのプロパティを受け入れられるようにショートカットを更新し、必須パラメーターを含め、ドキュメントにそれらが反映されていることを確認します。

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

評価

技術スタック
openapi, typescript
領域
api, documentation
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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