graphql scaffold
Rails generator for scaffolding models with GraphQL-Ruby.
Installation
Install from RubyGems by adding it to your Gemfile
:
gem 'graphql_scaffold'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install graphql_scaffold
Dependencies
The scaffolded graphql queries, mutations and subscriptions depend on:
SearchObjectGraphql
>= 0.3SearchObject
>= 1.2.3Graphql
>= 1.9.5
Besides this you may need to run the following command to begin with Graphql:
$ rails generate graphql:install
Usage
If you have a model already created:
$ rails generate graphql_scaffold model_example
If you want to create a model and scaffold your Graphql API:
$ rails generate graphql_scaffold model_example field1 field2:integer field3
After this, you may need to run rails db:migrate
. The format for fields are the same as rails generate model.
Example
Todo
- Create subscription scaffold
- Better tests
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Run the tests (
rake
) - Create new Pull Request
License
MIT License