Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/graphql-community/graphql-directive-uppercase
π Directive that makes your Strings uppercased
https://github.com/graphql-community/graphql-directive-uppercase
directive graphql uppercase
Last synced: about 7 hours ago
JSON representation
π Directive that makes your Strings uppercased
- Host: GitHub
- URL: https://github.com/graphql-community/graphql-directive-uppercase
- Owner: graphql-community
- License: mit
- Created: 2018-04-04T19:55:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T10:45:19.000Z (almost 2 years ago)
- Last Synced: 2024-03-25T21:11:13.964Z (8 months ago)
- Topics: directive, graphql, uppercase
- Language: JavaScript
- Homepage:
- Size: 1.08 MB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# graphql-directive-uppercase
## Table of Contents
* [Introduction](#introduction)
* [Install](#install)
* [Usage](#usage)
* [Contributing](#contributing)
* [License](#license)## 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](https://www.npmjs.com/package/graphql) and [graphql-tools](https://www.npmjs.com/package/graphql-tools) as peer dependency_
## Usage
```js
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:
``````graphql
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Ε‘