https://github.com/factomproject/swapi
https://github.com/factomproject/swapi
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/factomproject/swapi
- Owner: FactomProject
- Created: 2017-04-12T13:58:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-10T12:40:48.000Z (almost 9 years ago)
- Last Synced: 2025-04-11T04:39:35.487Z (12 months ago)
- Language: Elixir
- Size: 6.84 KB
- Stars: 2
- Watchers: 25
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Swapi
Tool for checking consistency between swagger file and routes in phoenix
application.
Use only with phoenix framework.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `swapi` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:swapi, "~> 0.1.0", only: :dev}]
end
```
Otherwise please add it with `git:` directive:
```elixir
def deps do
{:swapi, git: "git@github.com:FactomProject/swapi.git", only: :dev},
end
```
## How to use it
```elixir
mix swapi swagger.yaml
```
where `swagger.yaml` is a swagger specification file.
### Uniform parameters in paths
Sometimes paths in swagger file and routes are consistent but because
documentation, and developer convenience could differ parameters have different
names, like: `/users/:user_id` vs. `/users/:id`. You may use `--uniform` option
which will change given path parameters to `:param1`, `:param2` etc.
```elixir
mix swapi swagger.yaml --uniform
```
This way you can still check if documentation and routes are consistent but
preserve naming (which is hard).
## Misc
Right now `swapi` omits `PATCH` methods, as phoenix generates those and `PUT`
methods with `resource` directive for updates, making it redundant.