All Projects → bhoriuchi → graphql-go-tools

bhoriuchi / graphql-go-tools

Licence: MIT license
Like apollo-tools for graphql-go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to graphql-go-tools

schemaglue
Naturally breaks down your monolithic graphql schema into bits and pieces and then glue them back together.
Stars: ✭ 117 (+431.82%)
Mutual labels:  schema, graphql-tools
reach-schema
Functional schema-driven JavaScript object validation library.
Stars: ✭ 34 (+54.55%)
Mutual labels:  schema
pony-capnp
Cap’n Proto plugin for generating serializable Pony classes. 🐴 - 🎩'n 🅿️
Stars: ✭ 19 (-13.64%)
Mutual labels:  schema
magnet
A JSON/BSON schema generator
Stars: ✭ 16 (-27.27%)
Mutual labels:  schema
sbt-avro
Plugin SBT to Generate Scala classes from Apache Avro schemas hosted on a remote Confluent Schema Registry.
Stars: ✭ 15 (-31.82%)
Mutual labels:  schema
schema-voyager
Visualize Datomic schema
Stars: ✭ 15 (-31.82%)
Mutual labels:  schema
another-json-schema
Another JSON Schema validator, simple & flexible & intuitive.
Stars: ✭ 48 (+118.18%)
Mutual labels:  schema
exodus
Migration tools for Tabular Data to Oracle JSON/Tabular Data
Stars: ✭ 19 (-13.64%)
Mutual labels:  schema
pysonDB
A Simple , ☁️ Lightweight , 💪 Efficent JSON based database for 🐍 Python. PysonDB-V2 has been released ⬇️
Stars: ✭ 293 (+1231.82%)
Mutual labels:  schema
graphql-example
GraphQL Sample Project
Stars: ✭ 32 (+45.45%)
Mutual labels:  graphql-tools
firestore-to-bigquery-export
NPM package for copying and converting Cloud Firestore data to BigQuery.
Stars: ✭ 26 (+18.18%)
Mutual labels:  schema
schema-and-structured-data-for-wp
Creating the best Structured Data and Schema plugin for WordPress
Stars: ✭ 66 (+200%)
Mutual labels:  schema
graphql-compose-dataloader
Add DataLoader to graphql-composer resolvers.
Stars: ✭ 18 (-18.18%)
Mutual labels:  schema
graphql-docker-api
A GraphQL Server for the Docker API
Stars: ✭ 57 (+159.09%)
Mutual labels:  schema
dbmisc
Tools for working with databases in R
Stars: ✭ 24 (+9.09%)
Mutual labels:  schema
NoSQLDataEngineering
NoSQL Data Engineering
Stars: ✭ 25 (+13.64%)
Mutual labels:  schema
decapi
Create GraphQL API by decorating TypeScript classes
Stars: ✭ 81 (+268.18%)
Mutual labels:  schema
metastore
A protobuf schema registry on steroids. It will keep track of the contracts throughout your organization, making sure no contract is broken.
Stars: ✭ 43 (+95.45%)
Mutual labels:  schema
typeforce
Another biased type checking solution for Javascript
Stars: ✭ 22 (+0%)
Mutual labels:  schema
garn-validator
Create validations with ease
Stars: ✭ 42 (+90.91%)
Mutual labels:  schema

graphql-go-tools

Like apollo-tools for graphql-go

Current Tools

MakeExecutableSchema

Currently supports:

  • Merge multiple graphql documents
  • Object type extending
  • Custom Directives
  • Import types and directives

Planned:

  • Schema-stitching

Limitations:

  • Only types and directives defined in the TypeDefs with schema language can be extended and have custom directives applied.

Example

func main() {
  schema, err := tools.MakeExecutableSchema(tools.ExecutableSchema{
    TypeDefs: `
    directive @description(value: String!) on FIELD_DEFINITION

    type Foo {
      id: ID!
      name: String!
      description: String
    }
    
    type Query {
      foo(id: ID!): Foo @description(value: "bazqux")
    }`,
    Resolvers: tools.ResolverMap{
      "Query": &tools.ObjectResolver{
        Fields: tools.FieldResolveMap{
          "foo": &tools.FieldResolver{
            Resolve: func(p graphql.ResolveParams) (interface{}, error) {
              // lookup data
              return foo, nil
            }
          },
        },
      },
    },
    SchemaDirectives: tools.SchemaDirectiveVisitorMap{
      "description": &tools.SchemaDirectiveVisitor{
        VisitFieldDefinition: func(field *graphql.Field, args map[string]interface{}) {
          resolveFunc := field.Resolve
          field.Resolve = func(p graphql.ResolveParams) (interface{}, error) {
            result, err := resolveFunc(p)
            if err != nil {
              return result, err
            }
            data := result.(map[string]interface{})
            data["description"] = args["value"]
            return data, nil
          }
        },
      },
    },
  })

  if err != nil {
    log.Fatalf("Failed to build schema, error: %v", err)
  }

  params := graphql.Params{
    Schema: schema,
    RequestString: `
    query GetFoo {
      foo(id: "5cffbf1ccecefcfff659cea8") {
        description
      }
    }`,
  }

  r := graphql.Do(params)
  if r.HasErrors() {
		log.Fatalf("failed to execute graphql operation, errors: %+v", r.Errors)
	}
	rJSON, _ := json.Marshal(r)
	fmt.Printf("%s \n", rJSON)
}

Handler

Modified graphql-go/handler with updated GraphiQL and Playground

See handler package

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].