graphql-directive-uppercase

1.0.0 • Public • Published

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) is all you have to do just yarn and then yarn dev. This will start the server (powered by Micro from ZEIT) and Babel for transpilation of index.js.

Run yarn test for unit tests (we using Jest)

License

The MIT License (MIT) 2018 - Jakub Beneš

Readme

Keywords

none

Package Sidebar

Install

npm i graphql-directive-uppercase

Weekly Downloads

15

Version

1.0.0

License

MIT

Unpacked Size

8.01 kB

Total Files

6

Last publish

Collaborators

  • jukben