Last active
February 24, 2020 22:15
-
-
Save thomsbg/5c1d8f0942eb0bd329e1ae6e43f3ab9f to your computer and use it in GitHub Desktop.
Flat component list read format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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