Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spier/plastic-api
Plastic API is a boilerplate for building API mockups with grape and swagger
https://github.com/spier/plastic-api
Last synced: about 1 month ago
JSON representation
Plastic API is a boilerplate for building API mockups with grape and swagger
- Host: GitHub
- URL: https://github.com/spier/plastic-api
- Owner: spier
- Created: 2016-01-07T19:01:07.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-12T20:03:44.000Z (almost 8 years ago)
- Last Synced: 2024-04-15T02:51:17.000Z (9 months ago)
- Language: JavaScript
- Size: 1010 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Plastic API
Plastic API is a boilerplate for building API mockups with ruby, using grape and [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification) (aka swagger specs).
The easiest way to host an API mockup based on this, is on [heroku](https://www.heroku.com).
## How to run this
Tested with ruby-2.3
bundle install
rackup
open http://localhost:9292## Why?
I frequently discuss required modifications to APIs with various teams.
Often the easiest way to agree on the requirements for an API, is to write a mockup that defines request
and response formats. The mockup data returned by such an API can be as realistic as you need it to be.It took a while to get this stack (below) to work, as there are various compatibility issues.
As I did not want to run into this problem every time I create a mock, I created this boilerplate repo.That being said, be careful when you upgrade either of the components of the stack!
## Deploying to heroku
See a sample deployment at https://plastic-api.herokuapp.com
Deploying to heroku is explained at https://devcenter.heroku.com/articles/git.
Create the app
heroku create
Then deploy new version with
git push heroku master
## Stack
This projects is a working example of a combination of
- [grape](https://github.com/ruby-grape/grape) (0.19.2) - DSL for API generation
- [grape-swagger](https://github.com/ruby-grape/grape-swagger) (0.27.0) - generating Swagger Spec for a grape API (generates Swagger Spec v2.0)
- [swagger-ui](https://github.com/swagger-api/swagger-ui) (2.1.5) - turns swagger.json specs into a nice interactive API console that runs in the browser## Similar projects
https://github.com/ruby-grape/grape-on-rack has the same Stack but doesn't not include the swagger-ui.
Also contains some good examples of how to build APIs with grape.## TODO
- upgrade to latest swagger-ui / at time of writing 2.2.10
- remove gems that are not needed
- provide some better sample APIs
- explain what can be done with rake (i.e. Show all API paths in the console)
- add localization for 'de' to swagger-ui (what is this good for?)## License
[MIT License (MIT)](http://spier.mit-license.org/)