Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define body as a field #92

Open
seancdavis opened this issue Jan 5, 2022 · 1 comment
Open

Define body as a field #92

seancdavis opened this issue Jan 5, 2022 · 1 comment

Comments

@seancdavis
Copy link
Collaborator

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:

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.

@stale
Copy link

stale bot commented Mar 6, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants