Skip to content

Instantly share code, notes, and snippets.

@thomsbg
Last active February 24, 2020 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomsbg/5c1d8f0942eb0bd329e1ae6e43f3ab9f to your computer and use it in GitHub Desktop.
Save thomsbg/5c1d8f0942eb0bd329e1ae6e43f3ab9f to your computer and use it in GitHub Desktop.
Flat component list read format
type EntryBody {
components: [EntryBodyComponent]
}
# all components have a plaintext and an html representation
interface EntryBodyComponent {
plaintext: String
html: String
}
type EntryBodyParagraph implements EntryBodyCompoent {
plaintext: String
richtext: JSON # an inline-only rich-text document (no '\n' chars or block formatting)
html: String
markdown: String # this also seems possible & easy to accomplish?
}
type EntryBodyImage {
image: ChorusAssetImage
caption: String
plaintext: String # return the url to the image
html: String # returns standard <figure> markup
}
# Use like
query {
entry(id: 1234) {
body {
components {
... on EntryBodyParagraph {
__typename # returns 'EntryBodyParagraph'
plaintext
}
... on EntryBodyImage {
image {
id
url
}
caption
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment