loopbackio / loopbackio/loopback-next
Confusing @model() syntax
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 5.1k
- フォーク
- 1.1k
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 27
説明
In LB3, users could specify model settings at two levels: as a root property or inside `options` property.
See https://stackoverflow.com/q/53307168/69868 for an example of LB3 syntax applied in an LB4 project:
```ts
@model({
settings: {strict: false},
name: 'client',
plural: 'clients',
options: {
mongodb: {
collection: 'clients',
},
},
})
export class Client extends Entity {
// ...
}
```
I am proposing to make two changes in LB4 to help users coming from LB3:
1. Recognize `options` the same way as `settings`. In the example above, `mongodb` settings are not picked by LB4 now. With the proposed change in place, LB4 will set `collection` to `clients` as expected. Alternatively, tell the user setting `options` that they are trying to set an unsupported model-definition property. This can be done at compiler level too.
2. Allow settings to be provided as top-level properties, for example:
```ts
@model({
name: 'client',
strict: false,
mongodb: {
collection: 'clients',
},
})
export class Client extends Entity {
// ...
}
```
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
@model() デコレーターから始めて、LB4 がモデル設定をどのように読み取るかを追跡し、その動作を issue の LB3 の例と比較します。オプションを受け入れるべきか拒否すべきか、またトップレベルの設定をサポートすべきかを解決します。選択した動作が Client の例に対して実装され、検証されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- backend-api-design
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100