Hi Guys,
in a CMS you probably would like to have an array of various content types declared as a schema inside of a parent schema:
-- Page
-- title (string)
-- slug (string|unique)
-- contentElements (relation|1:n)
--> currently only one schema is possible in the dropdown..
--> multi-selection of allowed schema types would be a great improvement
I do miss this kind of setup in the current backend. I found out that its possible with a workaround but it feels rather inconvenient, from the editor point of view and for the developer.
Cheers
Hi @dohomi The way we would support this is with GraphQL interfaces. It would allow you to write a query in the following ways:
Page(slug:"cool-post"){
photos: contentElements(filter: {__typename: "Photo"}){
... on Photo {
url
}
}
messages: contentElements(filter: {__typename: "Message"}){
... on Message {
text
}
}
}
or
Page(slug:"cool-post"){
contentElements{
__typename
... on Photo {
url
}
... on Message {
text
}
}
}
You can read more about this here http://graphql.org/learn/queries/#inline-fragments
Would this be a compelling solution to you?
@sorenbs yes that would be a great fit!
Duplicate of https://github.com/graphcool/prisma/issues/83
Most helpful comment
Hi @dohomi The way we would support this is with GraphQL interfaces. It would allow you to write a query in the following ways:
or
You can read more about this here http://graphql.org/learn/queries/#inline-fragments
Would this be a compelling solution to you?