Skip to content

Instantly share code, notes, and snippets.

@frikille
Last active August 2, 2018 09:54
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 frikille/8220a77049b617db553309f001ca8a85 to your computer and use it in GitHub Desktop.
Save frikille/8220a77049b617db553309f001ca8a85 to your computer and use it in GitHub Desktop.
Full schema definition example for GraphQL Input Union RFC
literal PostInputKind
literal ImageInputKind
input AddPostInput {
kind: ImageInputKind
title: String!
body: String!
}
input AddImageInput {
kind: PostInputKind
photo: String!
caption: String
}
inputUnion AddMediaBlock = AddPostInput | AddImageInput
input EditPostInput {
inputTypeName: PostInputKind
title: String
body: String
}
input EditImageInput {
inputTypeName: ImageInputKind
photo: String
caption: String
}
inputUnion EditMediaBlock = EditPostInput | EditImageInput
type PostBlock {
title: String
body: String
}
type ImageBlock {
photo: String
caption: String
}
union Content = PostBlock | ImageBlock
type Media {
id: ID
content: [Content]
}
type Mutation {
createMedia(content: [AddMediaBlock]!): Media
editMedia(id: ID! content: [EditMediaBlock!]): Media
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment