Skip to content

graphql-community/graphql-directive-uppercase

Repository files navigation

graphql-directive-uppercase

Table of Contents

Introduction

This is simple directive how to make you String fields UPPERCASED. On top of it, this could be a good start point for anyone interested in building their own one.

Install

yarn add graphql-directive-uppercase

This package requires graphql and graphql-tools as peer dependency

Usage

import { makeExecutableSchema } from 'graphql-tools';
import uppercaseDirective from 'graphql-directive-uppercase';
import typeDefs from './schema.graphql';
import resolvers from './resolvers';

export default makeExecutableSchema({
  typeDefs,
  resolvers,
  schemaDirectives: {
    upper: uppercaseDirective,
    uppercase: uppercaseDirective
  },
});
GraphQL schema:
type Person {
  id: Int
  name: String @upper
}

type Query {
  persons: [Person]
}

Contributing

I would love to see your contribution. ❤️

For local development (and testing), all you have to do is to run yarn and then yarn dev. This will start the Apollo server and you are ready to contribute 🎉

Run yarn test (try --watch flag) for unit tests (we are using Jest)

License

The MIT License (MIT) 2018 - Jakub Beneš

About

🔠 Directive that makes your Strings uppercased

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •