contentlayerdev / contentlayerdev/contentlayer
Define body as a field
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.5k
- Forks
- 192
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Rechercherichtung
Beginne mit dem Lesen von Issue #91 und der aktuellen Schema-Behandlung für `body`, `fields` und `bodyType`. Für das Issue gibt es noch keine festgelegte API oder Akzeptanzkriterien, daher ist eine Entscheidung der Maintainer erforderlich, bevor die Implementierung einen definierten Abschlusszustand haben kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100