contentlayerdev / contentlayerdev/contentlayer

Define body as a field

オープン
#92 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
meta: never-stale
主要言語
TypeScript
スター
3.5k
フォーク
192
PR マージ指標
30日以内にマージされた PR はありません

説明

Building on #91, `body` is the one field that feels a little too magical. It _just works_, which is great, but maybe not entirely obvious.

Putting this issue here to discuss separately.

One thought I had was that if we pursued #91, it'd justify this move more to me. In this case, the `fields` definition would contain **every property** in the document that is generated without a preceding underscore (generated/reserved).

While I like the magic, I also wouldn't mind being more explicit in my schema definition. We could remove the `bodyType` option and instead have something like this:

```js
fields: {
title: { type: 'string', required: true },
body: { type: 'mdx', source: 'body' }
}
```

This is just a first pass. TBH I don't like the shape of the API suggested above. Just something to get us thinking about this.

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

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

調査の方向性

まず issue #91 と、`body`、`fields`、`bodyType` の現在のスキーマ処理を読んでください。この issue にはまだ確定した API や受け入れ基準がないため、実装に定義された完了状態を持たせるには、先に maintainer の判断が必要です。

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

評価

技術スタック
typescript
領域
backend-api-design
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

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

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