Skip to content

Commit

Permalink
Merge branch 'sogko/master' into sogko/validator
Browse files Browse the repository at this point in the history
* sogko/master:
  re-export name & description
  Remove Get prefix from Type methods
  gqlerrors.GQLFormattedErrorSlice -> gqlerrors.FormattedErrors
  graphql.GQLFRParams -> graphql.ResolveParams
  graphql.FieldConfig -> graphql.Field
  graphql.FieldConfigMap -> graphql.Fields
  graphql.Graphql -> graphql.Do
  Fix declared but not used errors
  • Loading branch information
sogko committed Nov 18, 2015
2 parents 39e9c6a + ef782a5 commit c7d03dd
Show file tree
Hide file tree
Showing 31 changed files with 937 additions and 937 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

func main() {
// Schema
fields := graphql.FieldConfigMap{
"hello": &graphql.FieldConfig{
fields := graphql.Fields{
"hello": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.GQLFRParams) interface{} {
return "world"
Expand Down
114 changes: 57 additions & 57 deletions abstract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {

petType := graphql.NewInterface(graphql.InterfaceConfig{
Name: "Pet",
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
},
Expand All @@ -45,19 +45,19 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
_, ok := value.(*testDog)
return ok
},
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if dog, ok := p.Source.(*testDog); ok {
return dog.Name
}
return nil
},
},
"woofs": &graphql.FieldConfig{
"woofs": &graphql.Field{
Type: graphql.Boolean,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if dog, ok := p.Source.(*testDog); ok {
return dog.Woofs
}
Expand All @@ -76,19 +76,19 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
_, ok := value.(*testCat)
return ok
},
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if cat, ok := p.Source.(*testCat); ok {
return cat.Name
}
return nil
},
},
"meows": &graphql.FieldConfig{
"meows": &graphql.Field{
Type: graphql.Boolean,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if cat, ok := p.Source.(*testCat); ok {
return cat.Meows
}
Expand All @@ -100,10 +100,10 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
schema, err := graphql.NewSchema(graphql.SchemaConfig{
Query: graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.FieldConfigMap{
"pets": &graphql.FieldConfig{
Fields: graphql.Fields{
"pets": &graphql.Field{
Type: graphql.NewList(petType),
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
return []interface{}{
&testDog{"Odie", true},
&testCat{"Garfield", false},
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
Errors: nil,
}

result := graphql.Graphql(graphql.Params{
result := graphql.Do(graphql.Params{
Schema: schema,
RequestString: query,
})
Expand All @@ -165,11 +165,11 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
_, ok := value.(*testDog)
return ok
},
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
"woofs": &graphql.FieldConfig{
"woofs": &graphql.Field{
Type: graphql.Boolean,
},
},
Expand All @@ -180,11 +180,11 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
_, ok := value.(*testCat)
return ok
},
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
"meows": &graphql.FieldConfig{
"meows": &graphql.Field{
Type: graphql.Boolean,
},
},
Expand All @@ -199,10 +199,10 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
schema, err := graphql.NewSchema(graphql.SchemaConfig{
Query: graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.FieldConfigMap{
"pets": &graphql.FieldConfig{
Fields: graphql.Fields{
"pets": &graphql.Field{
Type: graphql.NewList(petType),
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
return []interface{}{
&testDog{"Odie", true},
&testCat{"Garfield", false},
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
Errors: nil,
}

result := graphql.Graphql(graphql.Params{
result := graphql.Do(graphql.Params{
Schema: schema,
RequestString: query,
})
Expand All @@ -264,8 +264,8 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
var humanType *graphql.Object
petType := graphql.NewInterface(graphql.InterfaceConfig{
Name: "Pet",
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
},
Expand All @@ -285,10 +285,10 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {

humanType = graphql.NewObject(graphql.ObjectConfig{
Name: "Human",
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if human, ok := p.Source.(*testHuman); ok {
return human.Name
}
Expand All @@ -306,19 +306,19 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
_, ok := value.(*testDog)
return ok
},
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if dog, ok := p.Source.(*testDog); ok {
return dog.Name
}
return nil
},
},
"woofs": &graphql.FieldConfig{
"woofs": &graphql.Field{
Type: graphql.Boolean,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if dog, ok := p.Source.(*testDog); ok {
return dog.Woofs
}
Expand All @@ -336,19 +336,19 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
_, ok := value.(*testCat)
return ok
},
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if cat, ok := p.Source.(*testCat); ok {
return cat.Name
}
return nil
},
},
"meows": &graphql.FieldConfig{
"meows": &graphql.Field{
Type: graphql.Boolean,
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
if cat, ok := p.Source.(*testCat); ok {
return cat.Meows
}
Expand All @@ -360,10 +360,10 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
schema, err := graphql.NewSchema(graphql.SchemaConfig{
Query: graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.FieldConfigMap{
"pets": &graphql.FieldConfig{
Fields: graphql.Fields{
"pets": &graphql.Field{
Type: graphql.NewList(petType),
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
return []interface{}{
&testDog{"Odie", true},
&testCat{"Garfield", false},
Expand Down Expand Up @@ -412,7 +412,7 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
},
}

result := graphql.Graphql(graphql.Params{
result := graphql.Do(graphql.Params{
Schema: schema,
RequestString: query,
})
Expand All @@ -428,30 +428,30 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {

humanType := graphql.NewObject(graphql.ObjectConfig{
Name: "Human",
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
},
})
dogType := graphql.NewObject(graphql.ObjectConfig{
Name: "Dog",
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
"woofs": &graphql.FieldConfig{
"woofs": &graphql.Field{
Type: graphql.Boolean,
},
},
})
catType := graphql.NewObject(graphql.ObjectConfig{
Name: "Cat",
Fields: graphql.FieldConfigMap{
"name": &graphql.FieldConfig{
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
"meows": &graphql.FieldConfig{
"meows": &graphql.Field{
Type: graphql.Boolean,
},
},
Expand All @@ -477,10 +477,10 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
schema, err := graphql.NewSchema(graphql.SchemaConfig{
Query: graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.FieldConfigMap{
"pets": &graphql.FieldConfig{
Fields: graphql.Fields{
"pets": &graphql.Field{
Type: graphql.NewList(petType),
Resolve: func(p graphql.GQLFRParams) interface{} {
Resolve: func(p graphql.ResolveParams) interface{} {
return []interface{}{
&testDog{"Odie", true},
&testCat{"Garfield", false},
Expand Down Expand Up @@ -530,7 +530,7 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
},
}

result := graphql.Graphql(graphql.Params{
result := graphql.Do(graphql.Params{
Schema: schema,
RequestString: query,
})
Expand Down
Loading

0 comments on commit c7d03dd

Please sign in to comment.