Skip to content

Commit

Permalink
FIX #42 remove Document type from GraphQLQuery` trait (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 authored Jul 26, 2018
1 parent 41c556c commit ee719a9
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ case class ApolloSourceGenerator(fileName: String,

q"""
object $typeName extends ..$additionalInits {
type Document = sangria.ast.Document
val document: Document = $document
val document: sangria.ast.Document = $document
case class Variables(..$inputParams)
case class Data(..$dataParams)
..$dataJsonDecoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import scala.meta._
*
* {{{
* trait GraphQLQuery {
* // the graphql document that should be executed
* type Document
*
* // the input variables
* type Variables
*
* // the returned data
* type Data
*
* // the document that should be executed
* val document: sangria.ast.Document
* }
* }}}
*/
Expand All @@ -27,10 +27,9 @@ object GraphQLQueryGenerator {

private val traitDefinition: Defn.Trait =
q"""trait $typeName {
type Document
type Variables
type Data
val document: Document
val document: sangria.ast.Document
}
"""

Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/blog/AddArticle.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object AddArticle {
object addArticle extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""mutation addArticle($$content: ArticleContent!) {
val document: sangria.ast.Document = graphql"""mutation addArticle($$content: ArticleContent!) {
addArticle(content: $$content) {
id
title
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/blog/BlogArticleQuery.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object BlogArticleQuery {
object BlogArticleQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query BlogArticleQuery($$query: ArticleQuery!) {
val document: sangria.ast.Document = graphql"""query BlogArticleQuery($$query: ArticleQuery!) {
articles(query: $$query) {
id
status
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/blog/BlogByID.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object BlogByID {
object Blog extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query Blog($$blogId: ID!) {
val document: sangria.ast.Document = graphql"""query Blog($$blogId: ID!) {
blog(id: $$blogId) {
title
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import io.circe.generic.semiauto.deriveDecoder
import sangria.macros._
object HeroAndFriends {
object HeroAndFriends extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query HeroAndFriends {
val document: sangria.ast.Document = graphql"""query HeroAndFriends {
hero {
name
friends {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import io.circe.generic.semiauto.deriveDecoder
import sangria.macros._
object HeroFragmentQuery {
object HeroFragmentQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query HeroFragmentQuery {
val document: sangria.ast.Document = graphql"""query HeroFragmentQuery {
hero {
...CharacterInfo
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars-circe/HeroNameQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import io.circe.generic.semiauto.deriveDecoder
import sangria.macros._
object HeroNameQuery {
object HeroNameQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query HeroNameQuery {
val document: sangria.ast.Document = graphql"""query HeroNameQuery {
hero {
name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import io.circe.generic.semiauto.deriveDecoder
import sangria.macros._
object InputVariables {
object InputVariables extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query InputVariables($$humanId: String!) {
val document: sangria.ast.Document = graphql"""query InputVariables($$humanId: String!) {
human(id: $$humanId) {
name
homePlanet
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars-circe/SearchQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import io.circe.generic.semiauto.deriveDecoder
import sangria.macros._
object SearchQuery {
object SearchQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query SearchQuery($$text: String!) {
val document: sangria.ast.Document = graphql"""query SearchQuery($$text: String!) {
search(text: $$text) {
__typename
... on Human {
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars/HeroAndFriends.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object HeroAndFriends {
object HeroAndFriends extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query HeroAndFriends {
val document: sangria.ast.Document = graphql"""query HeroAndFriends {
hero {
name
friends {
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars/HeroFragmentQuery.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object HeroFragmentQuery {
object HeroFragmentQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query HeroFragmentQuery {
val document: sangria.ast.Document = graphql"""query HeroFragmentQuery {
hero {
...CharacterInfo
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars/HeroNameQuery.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object HeroNameQuery {
object HeroNameQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query HeroNameQuery {
val document: sangria.ast.Document = graphql"""query HeroNameQuery {
hero {
name
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars/InputVariables.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object InputVariables {
object InputVariables extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query InputVariables($$humanId: String!) {
val document: sangria.ast.Document = graphql"""query InputVariables($$humanId: String!) {
human(id: $$humanId) {
name
homePlanet
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/apollo/starwars/SearchQuery.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sangria.macros._
object SearchQuery {
object SearchQuery extends GraphQLQuery {
type Document = sangria.ast.Document
val document: Document = graphql"""query SearchQuery($$text: String!) {
val document: sangria.ast.Document = graphql"""query SearchQuery($$text: String!) {
search(text: $$text) {
__typename
... on Human {
Expand Down

0 comments on commit ee719a9

Please sign in to comment.