All Projects → prisma-archive → Graphql Transform Schema

prisma-archive / Graphql Transform Schema

Transform, filter & alias resolvers of a GraphQL schema

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Graphql Transform Schema

Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (+394.05%)
Mutual labels:  graphql, graphql-server, graphql-schema
Apollo Server Vercel
⚫ Production-ready Node.js GraphQL server for Vercel Serverless Functions
Stars: ✭ 69 (-17.86%)
Mutual labels:  graphql, apollo, graphql-server
Graphql Up
Get a ready-to-use GraphQL API for your schema
Stars: ✭ 415 (+394.05%)
Mutual labels:  graphql, apollo, graphql-server
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+3482.14%)
Mutual labels:  graphql, graphql-server, graphql-schema
Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+1036.9%)
Mutual labels:  graphql, graphql-server, graphql-schema
Gramps Legacy
The core data source combination engine of GrAMPS.
Stars: ✭ 198 (+135.71%)
Mutual labels:  graphql, graphql-server, graphql-schema
Graphql Cost Analysis
A Graphql query cost analyzer.
Stars: ✭ 527 (+527.38%)
Mutual labels:  graphql, graphql-server, graphql-schema
Graphql Log
Add logging to your GraphQL resolvers so you know what's going on in your app.
Stars: ✭ 94 (+11.9%)
Mutual labels:  graphql, graphql-server, graphql-schema
Graphql Config
One configuration for all your GraphQL tools (supported by most tools, editors & IDEs)
Stars: ✭ 883 (+951.19%)
Mutual labels:  graphql, apollo, graphql-schema
Strawberry
A new GraphQL library for Python 🍓
Stars: ✭ 891 (+960.71%)
Mutual labels:  graphql, graphql-server, graphql-schema
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (+115.48%)
Mutual labels:  graphql, graphql-server, graphql-schema
Omdb Graphql Wrapper
🚀 GraphQL wrapper for the OMDb API
Stars: ✭ 45 (-46.43%)
Mutual labels:  graphql, apollo, graphql-server
Apollo Server
🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
Stars: ✭ 12,145 (+14358.33%)
Mutual labels:  graphql, graphql-server, graphql-schema
36 Graphql Concepts
📜 36 concepts every GraphQL developer should know.
Stars: ✭ 209 (+148.81%)
Mutual labels:  graphql, graphql-server, graphql-schema
Go Proto Gql
Protobuff plugins for generating graphql schema and golang to graphql bindings. Also supports a graphql gateway (Alpha)
Stars: ✭ 127 (+51.19%)
Mutual labels:  graphql, graphql-server, graphql-schema
Get Graphql Schema
Fetch and print the GraphQL schema from a GraphQL HTTP endpoint. (Can be used for Relay Modern.)
Stars: ✭ 443 (+427.38%)
Mutual labels:  graphql, apollo, graphql-schema
Prisma Tools
Prisma tools to help you generate CRUD system for GraphQL servers
Stars: ✭ 237 (+182.14%)
Mutual labels:  apollo, graphql-server, graphql-schema
Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+570.24%)
Mutual labels:  graphql, apollo, graphql-server
Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: ✭ 962 (+1045.24%)
Mutual labels:  graphql, apollo, graphql-server
Graphql Modules
⚠️ [DEPRECATED] GraphQL module library for Apollo.
Stars: ✭ 53 (-36.9%)
Mutual labels:  graphql, apollo, graphql-schema

graphql-transform-schema has been deprecated in favor of schema transforms as part of graphql-tools

graphql-transform-schema npm version Greenkeeper badge

Transform, filter & alias resolvers of a GraphQL schema

Install

yarn add graphql-transform-schema

Usage

By default transformSchema passes through all queries/mutations. (Open Demo)

import { transformSchema } from 'graphql-transform-schema'

// needed for remote schemas
import { createApolloFetch } from 'apollo-fetch'
import { makeRemoteExecutableSchema } from 'graphql-tools'

const schema = await makeRemoteExecutableSchema(createApolloFetch({
  uri: 'https://api.graph.cool/simple/v1/swapi',
}))

// hide every query/mutation except the `Starship` and `allStarships` query
const transformedSchema = transformSchema(schema, {
  '*': false,
  Starship: true,
  allStarships: true,
})

const transformedSchema = transformSchema(schema, {
  Query: {
    '*': false,
    Starship: true,
    allStarships: true,
  },
  Mutation: {
  
  },
  Starship: {
    '*': false,
    id: true,
  },
})

API

interface Rules {
  [fieldName: string]: boolean | Function
}

function transformSchema(schema: GraphQLSchema, rules: Rules): GraphQLSchema

Examples

Remove all createX and deleteX mutations

const transformedSchema = transformSchema(schema, {
  Mutation: {
    'create*': false,
    'delete*': false
  }
})

Overwrite resolved data

const typeDefs = `
  type Query {
    hello: String!
  }

  type Mutation {
    alexaHello(name: String!): String!
  }
`
const resolvers = {
  Query: {
    hello: () => 'Hello world',
  },
  Mutation: {
    alexaHello: (_, { name }) => `Alexa: Hello world, ${name}`,
  },
}
const schema = makeExecutableSchema({ typeDefs, resolvers })

const transformedSchema = transformSchema(schema, {
  alexaHello: ({ args, resolve }) => resolve(args).replace('Bob', 'Alice'),
})

Overwrite arguments

const typeDefs = `
  type Query {
    hello: String!
  }

  type Mutation {
    alexaHello(name: String!): String!
  }
`
const resolvers = {
  Query: {
    hello: () => 'Hello world',
  },
  Mutation: {
    alexaHello: (_, { name }) => `Alexa: Hello world, ${name}`,
  },
}
const schema = makeExecutableSchema({ typeDefs, resolvers })

const transformedSchema = transformSchema(schema, {
  alexaHello: ({ args, resolve }) => resolve({ name: 'John' }),
})

Next steps

  • [ ] Alias/rename types and fields
  • [ ] Transform field arguments
  • [ ] Compose new queries/mutations out of existing queries/mutations

Help & Community Slack Status

Join our Slack community if you run into issues or have questions. We love talking to you!

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].