0.0
No commit activity in last 3 years
No release in over 3 years
A gem for scaffolding rails api templates
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 5.0
~> 10.0
 Project Readme

ApiScaffold

A useful Rails API generator for scaffolding that follows the jsonapi.org specification (http://jsonapi.org/). Works with :

  • Fast JSON API/Active Model Serializers
  • Rspec/TestUnit
  • Fixtures/FactoryBot
  • Api Pagination

For example if you have :

  • Fast JSON API/AMS in your gemfile ? the scaffold will create a serializer and generate a controller using the scaffolded serializer.
  • Rspec as your configured test framework ? the scaffold will generate rspec working controller tests
  • api-pagination in your gemfile ? the scaffold will paginate the index method of scaffolded controller

Installation

Add this line to your application's Gemfile:

gem 'api_scaffold'

And then execute:

$ bundle

Or install it yourself as:

$ gem install api_scaffold

Usage

Add this code to config/routes.rb if you want your routes to be inserted under the v1 namespace.

namespace :api, defaults: { format: :json } do
  namespace :v1 do
  end
end

Execute this line in your terminal from your rails directory:

$ rails g api_scaffold Book title description:text

If you wish to specify the api version:

$ rails g api_scaffold Book title description:text --api-version=2

TODO

  • Nested resources
  • GraphQL

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/stefatkins/api_scaffold.

License

The gem is available as open source under the terms of the MIT License.